home *** CD-ROM | disk | FTP | other *** search
/ Light ROM 1 / LIGHT-ROM 1 (Amiga Library Services)(1994).iso / ffdisks / d883.lha / BBBBS / BBBBS59.lha / rexx / BBBBS.baud < prev    next >
Text File  |  1993-06-12  |  183KB  |  6,636 lines

  1. /* $VER: BBBBS.baud 5.9 © 1993 Richard Lee Stockton 11:24PM (12.6.93)
  2.        - FREELY DISTRIBUTABLE AS LONG AS THIS NOTICE REMAINS -
  3.  
  4.        BBBBS.baud. A full-featured BBS in ARexx for Baudbandit
  5.   based on 'Answer.baud'. Thanks to Greg Cunningham for BaudBandit!
  6.  
  7.    See Information/BBBBS.doc & rexx/bbsLOCAL.rexx for install info
  8. */
  9.  
  10. saypath='SYS:Utilities/Say'
  11.  
  12. copyright.=''
  13. copyright.1=STRIP(SUBSTR(SOURCELINE(1),10))
  14. copyright.2='
  15. from Gramma Software 17730-15th NE Suite 223 Seattle WA 98155'
  16. copyright.3='
  17. ARexx portions of this software copyright 1990-93 Richard Lee Stockton'
  18. copyright.4='- FREELY DISTRIBUTABLE as long as this notice remains -'
  19.  
  20. /* If QuickSortPort not found then try to run setup.rexx */
  21.  
  22. IF ~SHOW('P','QuickSortPort') THEN CALL setup.rexx()
  23. IF ~SHOW('P','QuickSortPort') THEN EXIT 666
  24.  
  25. IF SHOW('P','BBBBS') THEN
  26.   DO
  27.     SAY 'BBBBS is already running!'
  28.     EXIT 0
  29.   END
  30. CALL OPENPORT('BBBBS')
  31. CALL SETCLIP('BBS_version',copyright.1)
  32. CALL SETCLIP('BBS_localfiles')
  33. CALL SETCLIP('BBS_localusers')
  34. CALL SETCLIP('BBS_interpret')
  35. CALL SETCLIP('BBS_maint')
  36. CALL SETCLIP('BBS_MESSAGE')
  37. CALL SETCLIP('BBS_BROWSE')
  38. CALL SETCLIP('BBS_MSGS')
  39. CALL SETCLIP('BBS_QUIT')
  40.  
  41. /* try to trap everything */
  42.  
  43. OPTIONS RESULTS
  44. OPTIONS FAILAT 999999
  45. NUMERIC DIGITS 14
  46. SIGNAL ON HALT
  47. SIGNAL ON SYNTAX
  48. SIGNAL ON FAILURE
  49. SIGNAL OFF BREAK_C
  50. SIGNAL OFF BREAK_E
  51.  
  52. PARSE VERSION . . cpu .
  53. cpu=RIGHT(cpu,2)/10
  54. IF cpu<1 THEN cpu=1
  55. Status Vers
  56. BB_VERS=RESULT
  57. bm=50
  58. IF RIGHT(BB_VERS,4)>1.59 THEN bm=25
  59.  
  60. dcd
  61. IF RC=0 THEN Send 'ATH1\r'
  62.  
  63. bbsprefs.=0  /* start with all prefs OFF */
  64. alpha.=''
  65. logonflag=1
  66. emailonline=-1
  67. CALL zerovars()
  68.  
  69.  
  70. /* TEXT - User data structure by line */
  71.  
  72. text.=''
  73. text.1='   Full Name'
  74. text.2='      Street'
  75. text.3='City, ST Zip'
  76. text.4=' Voice Phone'
  77. text.5='    Password'
  78. text.6='    Protocol'
  79. text.7='LinesPerPage'
  80. text.8=' Preferences'
  81. text.9='    Computer'
  82. text.10='   Interests'
  83. text.11='Session Time'
  84. text.12='FirstSession'
  85. text.13='Last Session'
  86. text.14='      UpLoad'
  87. text.15='    Download'
  88. text.16='   Last File'
  89. text.17='Ratio  Email'
  90. text.18='    Winnings'
  91. text.19='       Usage'
  92. text.20='       Level'
  93. text.21='Exclude DIRS'
  94. text.22='   Msgs Read'
  95. text.23='   Msgs Writ'
  96.  
  97.  
  98. name=''
  99. CR='0D'x
  100. LF='0A'x
  101.  
  102. SAY CR
  103. SAY CENTER(copyright.1,75)||CR
  104.  
  105. CALL PRAGMA('W','N')
  106. CALL config()
  107. IF bbsprefs.15~=0 THEN
  108.   CALL send2log('===== BBBBS started' DATE('W') DATE() TIME('C') '=====')
  109.  
  110. IF ~EXISTS(bbspath'Numbers/FirstLogon') THEN
  111.   ADDRESS COMMAND 'C:Date >'bbspath'Numbers/FirstLogon'
  112.  
  113. SAY CENTER(copyright.2,75)||CR
  114.  
  115. /* open printer? */
  116. IF bbsprefs.3 THEN
  117.   DO
  118.     IF ~OPEN(p,'PRT:','W') THEN
  119.       DO
  120.         CALL send2log('failed to open printer.')
  121.         bbsprefs.3=0
  122.       END
  123.   END
  124.  
  125. /* CALL PRAGMA('W','W')   <-- UN-COMMENT THIS LINE TO ENABLE REQUESTERS */
  126. CALL colors(1)
  127. Capture OFF
  128. Timeout 120
  129. SAY CENTER(copyright.3,75)||CR
  130.  
  131. excuses.=''
  132. courtesy=''
  133. courtesyflag=0
  134. SAY CENTER(copyright.4,75)||CR
  135. SAY CR
  136. SAY CR
  137. SAY '                      Setting up, please wait...'CR
  138. SAY CR
  139.  
  140. msg.=''
  141. IF readopen(bbspath'Lists/Conferences') THEN
  142.   DO
  143.     DO i=1
  144.       line=READLN(f)
  145.       IF line='END' THEN BREAK
  146.       IF EOF(f) THEN BREAK
  147.       num=WORD(line,1)
  148.       IF DATATYPE(num,'W') THEN msg.num=WORD(line,2)
  149.     END
  150.     CALL CLOSE(f)
  151.   END
  152.  
  153. dirs.=''
  154. IF readopen(bbspath'Lists/Libraries') THEN
  155.   DO
  156.     DO i=1
  157.       line=READLN(f)
  158.       IF line='END' | EOF(f) THEN LEAVE i
  159.       num=WORD(line,1)
  160.       IF DATATYPE(num,'W') THEN dirs.num=STRIP(WORD(line,2))
  161.     END
  162.     CALL CLOSE(f)
  163.   END
  164. CALL loaduserlist()
  165. SAY CR
  166. SAY '          The larger the BBS gets, the longer it takes to setup...'CR
  167. CALL loadfiles()
  168. dcd
  169. IF RC~=0 THEN
  170.   DO
  171.     SAY CR
  172.     SAY '      If it seems to take forever, ask the sysop to try' pen3'Resident'def 'mode.'CR
  173.   END
  174. SAY CR
  175. CALL set_grand()
  176. CALL loadalpha()
  177.  
  178. dcd
  179. IF RC=0 THEN
  180.   DO
  181.     logonflag=0
  182.     SIGNAL DONE
  183.   END
  184.  
  185. LOGON:
  186. CALL checkdcd()
  187. bps=0
  188. SetMark 'CONNECT'
  189. IF RC=1 THEN
  190.   DO
  191.     GetLine
  192.     connectline=RESULT
  193.     PARSE VAR connectline 'CONNECT'bps
  194.     CALL STRIP(bps)
  195.     DO i=3 WHILE DATATYPE(SUBSTR(bps,i,1),'N')
  196.     END
  197.     bps=LEFT(bps,i-1)
  198.   END
  199. IF bps<300 | bps>38400 THEN
  200.   DO
  201.     SetMark 'CARRIER'
  202.     IF RC=1 THEN
  203.       DO
  204.         GetLine
  205.         connectline=RESULT
  206.         PARSE VAR connectline 'CARRIER'bps
  207.         CALL STRIP(bps)
  208.       END
  209.     ELSE bps='000 '
  210.   END
  211. DO i=3 WHILE DATATYPE(SUBSTR(bps,i,1),'N')
  212. END
  213. bps=LEFT(bps,i-1)
  214. SIGNAL ON BREAK_C
  215. SIGNAL OFF BREAK_E
  216. REMOTE ON
  217. TimeOut 120
  218. IF bps<300 THEN bps=getbaudrate()
  219. IF bps>16800 THEN bps=getinput(1 0 'Please enter your modem to modem baudrate > ')
  220. IF bps<300 THEN SIGNAL DONE
  221. bps=bps%1
  222. IF logonflag=0 THEN
  223.   DO
  224.     logonflag=1
  225.     DO i=1 TO 7
  226.       SAY '  'CR
  227.     END
  228.     DO i=1 TO 4
  229.       SAY CENTER(copyright.i,75)||CR
  230.     END
  231.     CALL DELAY(150)
  232.     CALL colors(1)
  233.     SAY CR
  234.     SAY CR
  235.     SAY CR
  236.   END
  237.  
  238. IF alpha.0='' THEN CALL loadalpha()
  239.  
  240. CALL TIME('R')
  241.  
  242. /** Identify (title) message */
  243. IF EXISTS(bbspath'BBS_TEXT/HELLO') THEN
  244.   DO
  245.     nonstop=1
  246.     arg=bbspath'BBS_TEXT/HELLO'
  247.     CALL readlines(arg 1)
  248.     CALL seelines(0)
  249.     nonstop=0
  250.   END
  251. SAY CR
  252.  
  253. SAY 'Running on' BB_VERS 'at' bps 'baud. ' TIME('C') DATE('W') DATE()||CR
  254. Stat 'Z'
  255. CALL checkdcd()
  256.  
  257. /* Ask for name */
  258. name=''
  259. courtesy=''
  260. Queue CR
  261. DO count=1 TO 3
  262.   name=getinput(1 0 'Please enter name: ')
  263.   name=cleanstring(1':'name)
  264.   IF name='NEW' THEN LEAVE count
  265.   IF name~='' THEN
  266.     DO
  267.       IF FIND(userlist,name)>0 THEN LEAVE count
  268.       IF FIND(exclusion,name)>0 THEN
  269.         DO
  270.           SAY 'Sorry, that is a reserved name.'CR
  271.           name=''
  272.           ITERATE count
  273.         END
  274.       CALL loadcourtesy()
  275.       IF bbsprefs.7>0 | FIND(courtesy,name)>0 THEN
  276.         DO
  277.           SAY CR
  278.           SAY 'Welcome' name'!'CR
  279.           SAY 'You will be automatically validated after you enter your user info.'CR
  280.           SAY CR
  281.           LEAVE count
  282.         END
  283.     END
  284.   IF count<3 THEN SAY 'New Users please enter NEW to apply for validation.'CR
  285. END
  286. IF count>3 THEN SIGNAL DONE
  287. CALL TIME('R')
  288. logontime=TIME('C')
  289. line=left(name,16,' ') 'logged in  at' time('C') date('W') date() 'at' bps 'baud'
  290. CALL send2log(line)
  291. CALL checkUser()
  292. IF UPPER(WORD(data.12,3))~='BIRTHDAY:' THEN
  293.   DO
  294.     SAY CR
  295.     SAY 'Please help us out by entering the following information.'CR
  296.     CALL getbirth()
  297.     SAY '   Thank you!'CR
  298.   END
  299. prevcaller=''
  300. prevcaller=GETCLIP('BBS_lastcaller')
  301. IF prevcaller~='' THEN CALL SETCLIP('BBS_prevcaller',prevcaller)
  302. city=docity(data.3)
  303. CALL SETCLIP('BBS_lastcaller',name city'  'TIME('C') DATE())
  304. CALL SETCLIP('BBS_level',level)
  305. CALL postuser(0)
  306. CALL sound('LOGON')
  307. Timeout maxidle         /* max idle time at prompts */
  308.  
  309. IF RIGHT(WORD(data.12,4),4)=RIGHT(DATE('S'),4) THEN
  310.   DO
  311.     arg=bbspath'BBS_TEXT/BIRTHDAY'
  312.     IF EXISTS(arg) THEN 
  313.       DO
  314.         SAY CR
  315.         CALL showtext(arg)
  316.       END
  317.     SAY CR
  318.     SAY '***  Happy Birthday,' pen3||data.1||def', and many more!  ***'CR
  319.     SAY CR
  320.   END
  321. SAY CR
  322.  
  323. /* Get current protocol */
  324. Status Trans
  325. protocol=RESULT
  326.  
  327. CALL bbsLOGON.baud(name level)
  328. CALL sortlibraries()
  329. IF FIND(data.8,'QUICK')>0 THEN
  330.   DO
  331.     logonflag=0
  332.     CALL do_quick()
  333.     logonflag=1
  334.   END
  335.  
  336. /*
  337. Opening Display after logon. Seen by all Users ONCE A DAY. It first
  338. looks for a unique yearly data (ie, WELCOME.0704), then daily data
  339. (ie, WELCOME.Fri), and finally a simple, everyday 'WELCOME' datafile
  340. */
  341.  
  342. IF DATE('I')>lastondate THEN
  343.   DO
  344.     SAY CR
  345.     arg=bbspath'BBS_TEXT/WELCOME.'RIGHT(DATE('S'),4)
  346.     IF EXISTS(arg) THEN CALL showtext(arg)
  347.     SAY CR
  348.     arg=bbspath'BBS_TEXT/WELCOME.'LEFT(DATE('W'),3)
  349.     IF EXISTS(arg) THEN CALL showtext(arg)
  350.     SAY CR
  351.     arg=bbspath'BBS_TEXT/WELCOME'
  352.     IF EXISTS(arg) THEN CALL showtext(arg)
  353.  
  354. /*
  355. Looks for format UNTIL.YYYYMMDD ie, "UNTIL.19920514"
  356. Deletes any that are previous to "today"
  357. */
  358.  
  359.     untils.=''
  360.     IF FileList(bbspath'BBS_TEXT/UNTIL.*',untils)>0 THEN
  361.       DO
  362.         CALL QSORT(1,untils.0,untils)
  363.         DO ui=1 TO untils.0
  364.           IF RIGHT(untils.ui,8)<DATE('S') THEN CALL DELETE(untils.ui)
  365.           ELSE
  366.             DO
  367.               SAY CR
  368.               CALL showtext(untils.ui)
  369.             END
  370.         END
  371.       END
  372.     DROP untils.
  373.   END
  374.  
  375. IF bbsprefs.1 & ~terseflag THEN
  376.   DO
  377.     IF doGrin()>3 THEN CALL waiting()
  378.     IF EXISTS(bbspath'rexxDoors/Moon.rexx') THEN CALL Moon.rexx()
  379.     IF EXISTS(bbspath'rexxDoors/Time.rexx') THEN CALL Time.rexx()
  380.     IF FIND(UPPER(SHOWLIST('A')),'TODAY')>0 THEN
  381.       DO
  382.         IF EXISTS('RAM:TODAY') THEN
  383.           DO
  384.             finfo=STATEF('RAM:TODAY')
  385.             IF WORD(finfo,5)~=DATE('I') THEN
  386.               ADDRESS COMMAND 'C:Today091 >RAM:TODAY'
  387.           END
  388.         ELSE ADDRESS COMMAND 'C:Today091 >RAM:TODAY'
  389.         IF EXISTS('RAM:TODAY') THEN
  390.           DO
  391.             CALL readlines('RAM:TODAY' 1)
  392.             CALL seelines(0)
  393.           END
  394.       END
  395.     SAY CR
  396.   END
  397.  
  398. CALL readmail(0)
  399. IF ~terseflag THEN
  400.   DO
  401.     IF level>sysoplevel THEN
  402.       DO
  403.         lstmail=WORD(data.17,3)
  404.         IF ~DATATYPE(lstmail,'W') THEN lstmail=0
  405.         IF countcheck(bbspath'Numbers/LastMail' 0)>lstmail THEN
  406.           IF getinput(1 1 'Check Email? (Ny) > ')='Y' THEN CALL mailreport()
  407.         IF level<99 THEN
  408.           DO
  409.             SAY CR
  410.             CALL showtext(bbspath'Email/'sysop'/NEW_FILES')
  411.           END
  412.         SAY CR
  413.         CALL showtext(bbspath'Lists/NEW_USERS')
  414.       END
  415.     CALL logonstats()
  416.     CALL newinfo()
  417.   END
  418. CALL showmarked()
  419. CALL setdir(libpath||dirs.1)
  420. logonflag=0
  421.  
  422.  
  423. /***** MAIN *****/
  424.  
  425. IF menu~='ALL' THEN menu='MAIN'
  426.  
  427. RESTART:
  428. IF name='' | data.20='' | logonflag THEN SIGNAL LOGON  /* login was interrupted */
  429. SIGNAL ON BREAK_C
  430. SIGNAL ON BREAK_E
  431.  
  432. waitchar=''
  433. string=''
  434. IF level<1 THEN menu='NEW'
  435. DO WHILE(opt~='G')
  436.   go=0
  437.   DO WHILE(~go)
  438.     IF waitchar='' | waitchar='?' THEN
  439.       DO
  440.         commands='cghiqsvwxyz!#,'
  441.         IF level>0  THEN commands='abcdefghijlmnoprstuvwxyz!$#&+,.'
  442.         IF level>sysoplevel THEN commands=commands'k%^()=;'
  443.         IF level=99 THEN commands=commands'@~'
  444.         commands=commands'?'
  445.         IF menuflag | waitchar='?' | string='?' THEN
  446.           DO
  447.             opt='MENU'
  448.             arg=''
  449.             CALL postuser(1)
  450.             CALL menus()
  451.           END
  452.         ELSE SAY pen3'COMMANDS:'def commands||CR
  453.       END
  454.     CALL showtime()
  455.     line=''
  456.     line=line||bak2' 'TIME('C')' 'def
  457.     IF menu='ALL' | menu='FILE' THEN
  458.       line=line pen3'FILE_LIBRARY:'plaindir||def
  459.     ELSE IF menu='MSG' THEN line=line pen3'MESSAGES:'def
  460.     ELSE line=line pen3'MAIN:'def
  461.     IF waitchar='' THEN waitchar=getinput(0 0 line' > ')
  462.     PARSE VAR waitchar string' 'arg
  463.     CALL checkdcd()
  464.     nonstop=0
  465.     string=UPPER(STRIP(string))
  466.     IF string='OFF' | string='BYE' THEN SIGNAL LOGOUT2
  467.     waitchar=''
  468.     warnings=0
  469.     IF DATATYPE(string,'W') THEN
  470.       DO
  471.         dirnum=string
  472.         CALL chdir2()
  473.         CALL since()
  474.       END
  475.     IF string='QUICK' THEN CALL do_quick()
  476.     IF LEFT(string,3)='+++' THEN string=''
  477.     opt=left(string,1)
  478.     IF opt='G' THEN
  479.       DO
  480.         IF getinput(1 1 pen3'Logoff? (nY) > 'def)='N' THEN opt='?'
  481.       END
  482.     go=1    /* check for access */
  483.     IF POS(opt,UPPER(commands))=0 THEN go=0
  484.   END
  485.   CALL postuser(1)
  486.   OPTIONS PROMPT 'Filename: '
  487.   SELECT
  488.     WHEN opt='A' THEN CALL showalpha()
  489.     WHEN opt='B' THEN CALL browse()
  490.     WHEN opt='C' THEN CALL editor('MAIL' sysop)
  491.     WHEN opt='D' THEN CALL dload()
  492.     WHEN opt='E' THEN CALL readmail(1)
  493.     WHEN opt='F' THEN IF menu~='ALL' THEN menu='FILE'
  494.     WHEN opt='H' THEN CALL help('MAIN')
  495.     WHEN opt='I' THEN CALL information()
  496.     WHEN opt='J' THEN CALL jump2rexx()
  497.     WHEN opt='K' THEN CALL killuser()
  498.     WHEN opt='L' THEN CALL list()
  499.     WHEN opt='M' THEN IF menu~='ALL' THEN menu='MSG'
  500.     WHEN opt='N' THEN CALL newfiles()
  501.     WHEN opt='O' THEN CALL otheruser()
  502.     WHEN opt='P' THEN CALL editor('MSG')
  503.     WHEN opt='R' THEN CALL readmessages()
  504.     WHEN opt='S' THEN CALL bbsSEARCH()
  505.     WHEN opt='T' THEN CALL chpro()
  506.     WHEN opt='U' THEN CALL uload(1)
  507.     WHEN opt='V' THEN CALL showtext(bbspath'Usage/USER.LOG')
  508.     WHEN opt='W' THEN CALL showuserlist()
  509.     WHEN opt='X' THEN CALL switchmenuflag()
  510.     WHEN opt='Y' THEN CALL edituser()
  511.     WHEN opt='Z' THEN CALL counts()
  512.     WHEN opt='~' THEN CALL sysED(1)
  513.     WHEN opt='!' THEN CALL yell()
  514.     WHEN opt='@' THEN CALL shell()
  515.     WHEN opt='#' THEN CALL switchcolors()
  516.     WHEN opt='$' THEN IF menu='ALL' THEN menu='MAIN'; ELSE menu='ALL'
  517.     WHEN opt='%' THEN CALL editnote()
  518.     WHEN opt='^' THEN CALL readlogs()
  519.     WHEN opt='&' THEN CALL profiles(1)
  520.     WHEN opt='+' THEN CALL ext_dload()
  521.     WHEN opt='(' THEN CALL filereport()
  522.     WHEN opt=')' THEN CALL mailreport()
  523.     WHEN opt='=' THEN CALL levelreport()
  524.     WHEN opt=';' THEN CALL changename()
  525.     WHEN opt=',' THEN DO;CALL hourly();CALL waiting();END
  526.     WHEN opt='.' THEN IF menu~='ALL' THEN menu='MAIN'
  527.     WHEN opt='?' THEN IF menuflag THEN CALL help('MAIN')
  528.     OTHERWISE NOP
  529.   END
  530. END
  531. SIGNAL LOGOUT
  532. EXIT       /* an extra margin of safety */
  533.  
  534.  
  535. /* FUNCTIONS */
  536.  
  537. cleanstring:
  538. PARSE ARG nflag':'cstr
  539. bot=TRIM(XRANGE(,' '))
  540. bot=COMPRESS(bot,'1B'x)  /* ESC for ANSI */
  541. top=XRANGE('7F'x)
  542. IF nflag=1 THEN
  543.   DO
  544.     bot=bot||XRANGE('!','@')'[\]`~{:}'
  545.     cstr=TRANSLATE(UPPER(cstr),' ','_')
  546.   END
  547. cstr=COMPRESS(cstr,bot||top)
  548. IF nflag~=2 THEN cstr=STRIP(cstr)
  549. IF nflag=1 THEN cstr=SPACE(cstr,1,'_')
  550. RETURN cstr
  551.  
  552.  
  553. showtext:
  554. PARSE ARG arg .
  555. IF EXISTS(arg) THEN
  556.   DO
  557.     CALL readlines(arg 1)
  558.     CALL seelines(1)
  559.     nonstop=0
  560.     CALL waiting()
  561.   END
  562. RETURN
  563.  
  564.  
  565. doGrin:
  566. IF ~EXISTS(bbspath'rexxDoors/Grin_du_Jour.rexx') THEN RETURN 0
  567. CALL setdir(bbspath'rexxDoors')
  568. temp=Grin_du_Jour.rexx()
  569. SAY CR
  570. RETURN temp
  571.  
  572.  
  573. send2log:
  574. PARSE ARG sendline
  575. logfile=bbspath'Logs/log.'DATE('S')    /* daily logs */
  576. IF ~OPEN('log',logfile,'A') THEN
  577.   DO
  578.     IF ~OPEN('log',logfile,'W') THEN
  579.       DO
  580.         SAY 'failed to open log file'
  581.         SIGNAL DONE
  582.      END
  583.   END
  584. CALL WRITELN('log',sendline)
  585. CALL CLOSE('log')
  586. IF bbsprefs.3=1 THEN CALL WRITELN(p,sendline)
  587. RETURN
  588.  
  589.  
  590. send2last:
  591. PARSE ARG sendline
  592. IF name=sysop THEN RETURN   /* delete to have sysop in USER.LOG */
  593. lynes.=''
  594. lynes.0=2
  595. lynes.1='        -'pen3 bbsname def'user log for the last 99 calls -'
  596. lynes.2=sendline
  597. logfile=bbspath'USAGE/USER.LOG'  /* simple usage log */
  598. IF EXISTS(logfile) THEN
  599.   DO
  600.     x=OPEN(lu,logfile,'R')
  601.     IF x=0 THEN RETURN
  602.     CALL READLN(lu)
  603.     DO i=3 TO 99
  604.       sendline=READLN(lu)
  605.       IF EOF(lu) THEN LEAVE i
  606.       lynes.i=sendline
  607.     END
  608.     CALL CLOSE(lu)
  609.     IF i>99 THEN lynes.0=99
  610.     ELSE lynes.0=i-1
  611.   END
  612. x=OPEN(lu,logfile,'W')
  613. IF x=0 THEN RETURN
  614. DO i=1 TO lynes.0
  615.   CALL WRITELN(lu,lynes.i)
  616. END
  617. CALL CLOSE(lu)
  618. RETURN
  619.  
  620.  
  621. do_quick:
  622. IF FIND(UPPER(data.8),'QUICK')=0 THEN
  623.   DO
  624.     SAY 'The QUICK option is OFF in your current settings.'CR
  625.     IF getinput(1 1 'Turn the QUICK option ON? (nY) >')='N' THEN RETURN
  626.     data.8=data.8 'QUICK'
  627.     CALL saveData(0)
  628.   END
  629. IF getinput(1 1 'Edit your QUICK exclude list? (Ny) >')='Y' THEN
  630.   DO
  631.     SAY CR
  632.     SAY 'You may EXCLUDE any of these from your QUICK archives.'CR
  633.     SAY pen3||LEFT('-',74,'-')||def||CR
  634.     temp=LEFT(' ',7)
  635.     SAY temp'HELLO          - Pre-logon message.'CR
  636.     SAY temp'WELCOME        - Post-logon message.'CR
  637.     SAY temp'GOODBYE        - Logoff message.'CR
  638.     SAY temp'HOURLY         - Average-Minutes-Per-Hour usage graph.'CR
  639.     SAY temp'STATS.BBS      - Most of the Z command from the main menu.'CR
  640.     SAY temp'<filename>     - ANY file in the Information area.'CR
  641.     SAY temp'MESSAGES       - New conference messages.'CR
  642.     SAY temp'FILELIST       - New file descriptions.'CR
  643.     SAY pen3||LEFT('-',74,'-')||def||CR
  644.     SAY 'Enter a space separated list of what you wish to exclude.'CR
  645.     SAY pen3'Exclude:'def data.26||CR
  646.     temp=getinput(1 0 pen3'Exclude: 'def)
  647.     IF temp='' & data.26~='' THEN
  648.       DO
  649.         IF getinput(1 1 'Clear the QUICK exclude list? (nY) > ')~='N' THEN
  650.           data.26=''
  651.       END
  652.     ELSE data.26=temp
  653.     temp='Your QUICK archives will exclude'pen3
  654.     IF data.26='' THEN temp=temp 'nothing!'
  655.     ELSE temp=temp data.26
  656.     SAY temp||def||CR
  657.     CALL saveData(0)
  658.     SAY CR
  659.   END
  660. IF GETCLIP('BBS_'name)~='' THEN
  661.   DO
  662.     SAY CR
  663.     SAY 'The QUICK routines are still working on your archive...'CR
  664.     SAY 'Please try again later.'CR
  665.     SAY CR
  666.     RETURN
  667.   END
  668. quickdir=bbspath'EmailFiles/'name
  669. CALL MAKEDIR(quickdir)
  670. CALL setdir(quickdir)
  671. IF getinput(1 1 'Do you have a QUICKIN file to upload? (Ny) >')='Y' THEN
  672.   DO
  673.     arg='QUICKIN.lha'
  674.     ul=2
  675.     DO WHILE ul=2
  676.       ul=uload(0)
  677.     END
  678.   END
  679. IF EXISTS(bbspath'EmailFiles/'name'/QUICKIN.lha') & level>=sysoplevel THEN
  680.   IF getinput(1 1 'Process your QUICKIN archive [N]ow or at [L]ogoff? (Ln) > ')='N' THEN
  681.     DO
  682.       ADDRESS AREXX bbsQUICKIN.rexx name level sysoplevel bbsprefs.6
  683.       SAY CR
  684.       SAY 'Processing QUICKIN archive...'CR
  685.       SAY CR
  686.     END
  687. IF GETCLIP('BBS_'name)='QUICK' THEN
  688.   DO
  689.     SAY CR
  690.     SAY 'The QUICK routines are still working on your file(s)...'CR
  691.     SAY CR
  692.     RETURN
  693.   END
  694. arg='RAM:dirlist'
  695. ADDRESS COMMAND 'C:list >'arg quickdir'/QUICK_#? DATES'
  696. IF WORD(STATEF(arg),2)>80 THEN
  697.   DO
  698.     CALL readlines(arg 1)
  699.     CALL seelines(0)
  700.     SAY CR
  701.   END
  702. efiles=UPPER(SHOWDIR(quickdir))
  703. DO i=1 TO WORDS(efiles)
  704.   arg=WORD(efiles,i)
  705.   IF LEFT(arg,6)='QUICK_' & RIGHT(arg,4)='.LHA' THEN
  706.     DO
  707.       SAY arg 'is' WORD(STATEF(arg),2) 'bytes.'CR
  708.       qarg=arg
  709.       DO WHILE dload()=1
  710.       END
  711.       IF getinput(1 1 'Delete' qarg'? (nY) > ')~='N' THEN
  712.         DO
  713.           CALL DELETE(quickdir'/'qarg)
  714.           CALL DELETE(quickdir'/'qarg'.xdl')
  715.         END
  716.     END
  717. END
  718. arg=''
  719. SAY CR
  720. IF GETCLIP('BBS_'name)~='' THEN RETURN
  721. IF getinput(1 1 'Archive new BBS activity? (nY) > ')~='N' THEN
  722.   DO
  723.     CALL SETCLIP('BBS_city',city)
  724.     CALL SETCLIP('BBS_'name'_26',data.26)
  725.     IF FIND(UPPER(data.26),'STATS.BBS')=0 THEN
  726.       CALL SETCLIP('BBS_statsarg',emailonline grand grand2 files.0)
  727.     IF FIND(UPPER(data.26),'MESSAGES')=0 THEN
  728.       CALL SETCLIP('BBS_'name'_22',data.22)
  729.     CALL MAKEDIR(bbspath'EmailFiles/'name)
  730.     ADDRESS AREXX bbsQUICKOUT.rexx name level lastbrowse WORD(data.16,2) data.21
  731.     CALL send2log('Started QUICKOUT at' TIME('C'))
  732.     SAY CR
  733.     IF FIND(UPPER(data.26),'MESSAGES')=0 THEN
  734.       DO
  735.         clear_marked=1
  736.         DO i=1 TO level
  737.           IF WORD(data.22,i)~=-1 THEN
  738.             lastread.i=countcheck(bbspath'Numbers/LastMessage'i 0)
  739.         END
  740.         SAY CR
  741.       END
  742.     IF FIND(UPPER(data.26),'FILELIST')=0 THEN
  743.       lastbrowse=countcheck(bbspath'Numbers/LastFile' 0)
  744.     newfilesdate=DATE('S') TIME()
  745.     IF writeopen(bbspath'EmailFiles/'name'/Libraries') THEN
  746.       DO
  747.         DO i=1 TO libs.0
  748.           CALL WRITELN(f,libs.i)
  749.         END
  750.         CALL CLOSE(f)
  751.       END
  752.     IF writeopen(bbspath'EmailFiles/'name'/Conferences') THEN
  753.       DO
  754.         DO i=1 TO msgs.0
  755.           CALL WRITELN(f,msgs.i)
  756.         END
  757.         CALL CLOSE(f)
  758.       END
  759.     SAY CR
  760.     IF getinput(1 1 'Logoff Now? (nY) >')~='N' THEN
  761.       DO
  762.         SAY 'Your archive will be waiting next time you call...'CR
  763.         SAY CR
  764.         SIGNAL LOGOUT2
  765.       END
  766.     SAY 'You will be signaled if you are still online when your archive is ready...'CR
  767.     CALL saveData(1)
  768.   END
  769. ELSE
  770.   DO
  771.     SAY CR
  772.     IF getinput(1 1 'Logoff Now? (nY) >')~='N' THEN SIGNAL LOGOUT2
  773.   END
  774. SAY CR
  775. RETURN
  776.  
  777.  
  778. killuser:
  779. IF level<=sysoplevel THEN RETURN
  780. killcount=0
  781. DO loop=1
  782.   IF arg='' THEN
  783.     DO
  784.       OPTIONS PROMPT 'RETURN=QUIT  Username to Kill: '
  785.       PULL arg
  786.     END
  787.   IF STRIP(arg)='' THEN LEAVE loop
  788.   arg=UPPER(arg)
  789.   arg=SPACE(STRIP(arg),1,'_')
  790.   IF getinput(1 1 'Really kill' arg'? (nY) > ')='N' THEN
  791.     DO
  792.       arg=''
  793.       ITERATE loop
  794.     END
  795.   SAY 'Working...'lineup||CR
  796.   IF readlines(bbspath'Users/'arg 1) THEN
  797.     DO
  798.       SAY 'User' arg 'not found.'CR
  799.       arg=''
  800.       ITERATE loop
  801.     END
  802.   IF level<=lynes.20 THEN
  803.     DO
  804.       SAY '*** Tsk! Tsk!  Your level is not greater than' arg'.'CR
  805.       CALL send2log('Tried to kill:' arg)
  806.       arg=''
  807.       ITERATE loop
  808.     END
  809.   CALL DELETE(bbspath'Users/'arg)
  810.   IF EXISTS(bbspath'Email/'arg) THEN
  811.     DO
  812.       temp=WORDS(SHOWDIR(bbspath'Email/'arg))
  813.       emailonline=emailonline-temp
  814.       ADDRESS COMMAND 'C:DELETE >*' bbspath'Email/'arg 'ALL'
  815.     END
  816.   IF EXISTS(bbspath'EmailFiles/'arg) THEN
  817.     ADDRESS COMMAND 'C:DELETE >*' bbspath'EmailFiles/'arg 'ALL'
  818.   CALL send2log('Killed:' arg)
  819.   SAY CR'User file, Email & EmailFiles for' arg 'have been deleted.'CR
  820.   killcount=killcount+1
  821.   arg=''
  822. END
  823. IF killcount=0 THEN RETURN
  824. CALL DELETE(bbspath'Lists/USERS')
  825. sortuserflag=1
  826. RETURN
  827.  
  828.  
  829. menus:
  830. CALL checkdcd()
  831. SAY CR
  832. IF menu='NEW' THEN
  833. DO
  834.   SAY pen6'     _________________'def||CR
  835.   SAY pen6'  __/  'pen3'New User Menu'pen6'  \___'def||CR
  836.   SAY pen6' |                        |'def||CR
  837.   SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def||CR
  838.   SAY pen6' |'def'   ['pen3'I'def']nformation        'pen6'|'def||CR
  839.   SAY pen6' |'def'   ['pen3'Y'def']our user data     'pen6'|'def||CR
  840.   SAY pen6' |'def'   ['pen3'W'def']ho is here        'pen6'|'def||CR
  841.   SAY pen6' |'def'   ['pen3'S'def']earch user list   'pen6'|'def||CR
  842.   SAY pen6' |'def'   ['pen3'V'def']iew user log      'pen6'|'def||CR
  843.   SAY pen6' |'def'   ['pen3'Z'def'] bbs statistics   'pen6'|'def||CR
  844.   SAY pen6' |'def'   ['pen3','def'] hourly stats     'pen6'|'def||CR
  845.   SAY pen6' |'def'   ['pen3'X'def'] toggle menus     'pen6'|'def||CR
  846.   SAY pen6' |'def'   ['pen3'#'def'] toggle color     'pen6'|'def||CR
  847.   SAY pen6' |'def'   ['pen3'!'def'] YELL for SYSOP   'pen6'|'def||CR
  848.   SAY pen6' |'def'   ['pen3'C'def']omment to SYSOP   'pen6'|'def||CR
  849.   SAY pen6' |'def'   ['pen3'G'def']oodbye (hangup)   'pen6'|'def||CR
  850.   SAY pen6' |________________________|'def||CR
  851. END
  852. ELSE IF menu='MSG' THEN
  853. DO
  854.     SAY pen6'       ____________'def||CR
  855.     SAY pen6'  ____/  'pen3'Messages'pen6'  \_____'def||CR
  856.     SAY pen6' |                       |'def||CR
  857.     SAY pen6' |'def'   ['pen3'H'def']elp              'pen6'|'def||CR
  858.     SAY pen6' |'def'   ['pen3'P'def']ost messages     'pen6'|'def||CR
  859.     SAY pen6' |'def'   ['pen3'R'def']ead messages     'pen6'|'def||CR
  860.     SAY pen6' |'def'   ['pen3'S'def']earch messages   'pen6'|'def||CR
  861.     SAY pen6' |'def'   ['pen3'E'def']mail (private)   'pen6'|'def||CR
  862.     SAY pen6' |'def'   ['pen3'C'def']omment to SYSOP  'pen6'|'def||CR
  863.     SAY pen6' |'def'   ['pen3'!'def'] YELL for SYSOP  'pen6'|'def||CR
  864. IF(level>sysoplevel) THEN DO
  865.     SAY pen6' |'def'   ['pen3'^'def'] view BBS logs   'pen6'|'def||CR
  866.     SAY pen6' |'def'   ['pen3')'def'] email report    'pen6'|'def||CR
  867.     SAY pen6' |'def'   ['pen3'='def'] level report    'pen6'|'def||CR
  868.     SAY pen6' |'def'   ['pen3';'def'] change username 'pen6'|'def||CR;END
  869. IF(level=99) THEN DO
  870.     SAY pen6' |'def'   ['pen3'~'def'] online editor   'pen6'|'def||CR
  871.     SAY pen6' |'def'   ['pen3'@'def'] dos shell       'pen6'|'def||CR;END
  872.     SAY pen6' |'def'   ['pen3'F'def']iles menu        'pen6'|'def||CR
  873.     SAY pen6' |'def'   ['pen3'.'def'] main menu       'pen6'|'def||CR
  874.     SAY pen6' |_______________________|'def||CR
  875. END
  876. ELSE IF menu='FILE' THEN
  877. DO
  878.     SAY pen6'         _________'def||CR
  879.     SAY pen6'  ______/  'pen3'Files'pen6'  \_______'def||CR
  880.     SAY pen6' |                        |'def||CR
  881.     SAY pen6' |'def'   ['pen3'A'def']lphabetic list    'pen6'|'def||CR
  882.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def||CR
  883.     SAY pen6' |'def'   ['pen3'B'def']rowse filenotes   'pen6'|'def||CR
  884.     SAY pen6' |'def'   ['pen3'N'def']ew files list     'pen6'|'def||CR
  885.     SAY pen6' |'def'   ['pen3'L'def']ist by Library    'pen6'|'def||CR
  886.     SAY pen6' |'def'   ['pen3'S'def']earch files       'pen6'|'def||CR
  887.     SAY pen6' |'def'   ['pen3'V'def']iew user log      'pen6'|'def||CR
  888.     SAY pen6' |'def'   ['pen3'U'def']pload             'pen6'|'def||CR
  889.     SAY pen6' |'def'   ['pen3'D'def']ownload           'pen6'|'def||CR
  890.     SAY pen6' |'def'   ['pen3'T'def']ransfer protocol  'pen6'|'def||CR
  891.     SAY pen6' |'def'   ['pen3'+'def'] Extra Devices    'pen6'|'def||CR
  892. IF(level>sysoplevel) THEN DO
  893.     SAY pen6' |'def'   ['pen3'K'def']ill a user        'pen6'|'def||CR
  894.     SAY pen6' |'def'   ['pen3'%'def'] edit filenote    'pen6'|'def||CR
  895.     SAY pen6' |'def'   ['pen3'('def'] file report      'pen6'|'def||CR
  896.     SAY pen6' |'def'   ['pen3';'def'] change username  'pen6'|'def||CR;END
  897. IF(level=99) THEN DO
  898.     SAY pen6' |'def'   ['pen3'@'def'] dos shell        'pen6'|'def||CR;END
  899.     SAY pen6' |'def'   ['pen3'M'def']essages menu      'pen6'|'def||CR
  900.     SAY pen6' |'def'   ['pen3'.'def'] main menu        'pen6'|'def||CR
  901.     SAY pen6' |________________________|'def||CR
  902. END
  903. ELSE IF menu='MAIN' THEN
  904. DO
  905.     SAY pen6'       _____________'def||CR
  906.     SAY pen6'  ____/  'pen3'Main Menu'pen6'  \_____'def||CR
  907.     SAY pen6' |                        |'def||CR
  908.     SAY pen6' |'def'   ['pen3'H'def']elp               'pen6'|'def||CR
  909.     SAY pen6' |'def'   ['pen3'I'def']nfomation         'pen6'|'def||CR
  910.     SAY pen6' |'def'   ['pen3'J'def']ump to doorways   'pen6'|'def||CR
  911.     SAY pen6' |'def'   ['pen3'Y'def']our user data     'pen6'|'def||CR
  912.     SAY pen6' |'def'   ['pen3'W'def']ho is here list   'pen6'|'def||CR
  913.     SAY pen6' |'def'   ['pen3'S'def']earch userlist    'pen6'|'def||CR
  914.     SAY pen6' |'def'   ['pen3'O'def']ther users info   'pen6'|'def||CR
  915.     SAY pen6' |'def'   ['pen3'X'def']pert (no menus)   'pen6'|'def||CR
  916.     SAY pen6' |'def'   ['pen3'#'def'] toggle colors    'pen6'|'def||CR
  917.     SAY pen6' |'def'   ['pen3'$'def'] toggle menu(s)   'pen6'|'def||CR
  918.     SAY pen6' |'def'   ['pen3'&'def'] user profiles    'pen6'|'def||CR
  919.     SAY pen6' |'def'   ['pen3'Z'def'] bbs statistics   'pen6'|'def||CR
  920.     SAY pen6' |'def'   ['pen3','def'] hourly stats     'pen6'|'def||CR
  921.     SAY pen6' |'def'   ['pen3'G'def']oodbye (hangup)   'pen6'|'def||CR
  922.     SAY pen6' |'def'   ['pen3'F'def']iles menu         'pen6'|'def||CR
  923.     SAY pen6' |'def'   ['pen3'M'def']essages menu      'pen6'|'def||CR
  924.     SAY pen6' |________________________|'def||CR
  925. END
  926. ELSE IF menu='ALL' THEN
  927. DO
  928.     SAY pen6'     __________________________________________________________'def||CR
  929.     SAY pen6'  __/   'pen3'Main Menu            File Menu          Message Menu 'pen6'  \__'def||CR
  930.     SAY pen6' |                                                                |'def||CR
  931.     SAY pen6' |'def' ['pen3'H'def']elp               ['pen3'A'def']lphabetical list  ['pen3'P'def']ost messages      'pen6'|'def||CR
  932.     SAY pen6' |'def' ['pen3'I'def']nformation        ['pen3'B'def']rowse filenotes   ['pen3'R'def']ead messages      'pen6'|'def||CR
  933.     SAY pen6' |'def' ['pen3'Z'def'] bbs statiZtics   ['pen3'L'def']ist by Library    ['pen3'E'def']mail (private)    'pen6'|'def||CR
  934.     SAY pen6' |'def' ['pen3'Y'def']our user data     ['pen3'N'def']ew files          ['pen3'C'def']omment to SYSOP   'pen6'|'def||CR
  935.     SAY pen6' |'def' ['pen3'O'def']ther users info   ['pen3'D'def']ownload           ['pen3'!'def'] YELL for SYSOP   'pen6'|'def||CR
  936.     SAY pen6' |'def' ['pen3'J'def']ump to doorways   ['pen3'U'def']pload             ['pen3'X'def']pert (no menus)   'pen6'|'def||CR
  937.     SAY pen6' |'def' ['pen3'S'def']earch menu        ['pen3'T'def']ransfer protocol  ['pen3'$'def'] toggle menu(s)   'pen6'|'def||CR
  938.     SAY pen6' |'def' ['pen3'&'def'] user profiles    ['pen3'+'def'] Extra Devices    ['pen3'#'def'] toggle colors    'pen6'|'def||CR
  939.     SAY pen6' |'def' ['pen3'G'def']oodbye (logoff)   ['pen3'V'def']iew user log      ['pen3','def'] hourly stats     'pen6'|'def||CR
  940. IF(level>sysoplevel) THEN DO
  941.     SAY pen6' |'def' ['pen3'K'def']ill a user        ['pen3'%'def'] edit filenote    ['pen3'='def'] level report     'pen6'|'def||CR
  942.     SAY pen6' |'def' ['pen3'^'def'] view BBS logs    ['pen3'('def'] file report      ['pen3';'def'] change username  'pen6'|'def||CR;END
  943. IF(level=99) THEN
  944.     SAY pen6' |'def' ['pen3'~'def'] online editor    ['pen3'@'def'] dos shell        ['pen3')'def'] email report     'pen6'|'def||CR
  945.     SAY pen6' |________________________________________________________________|'def||CR
  946. END
  947. QUEUE CR  /* clears any un-CRed input in the queue */
  948. RETURN
  949.  
  950.  
  951. help:
  952. ARG helppath .
  953. SAY CR
  954. SAY 'For more detailed help, use ['pen3'I'def']nformation commmand to read BBBBS.COMMANDS.'CR
  955. IF helppath='MAIN' THEN
  956.   SAY 'Commands available from the' pen3||menu||def 'menu:'CR
  957. frontend=bbspath'BBS_HELP/'helppath
  958. backend='.USER'
  959. IF level=0 THEN backend='.NEW'
  960. ELSE IF level=99 THEN backend='.SUPER'
  961. ELSE IF level>sysoplevel THEN backend='.SYSOP'
  962. CALL showtext(frontend||backend)
  963. RETURN
  964.  
  965.  
  966. waiting:
  967. CALL checktime()
  968. IF waitchar='Q' THEN
  969.   DO
  970.     waitchar=''
  971.     RETURN
  972.   END
  973. waitchar=''
  974. IF nonstop=1 THEN RETURN
  975. OPTIONS PROMPT pen3'                          RETURN=Continue 'def
  976. PULL waitchar
  977. CALL cleanline(1)
  978. CALL checkdcd()
  979. RETURN
  980.  
  981.  
  982. waiting2:
  983. CALL checktime()
  984. IF nonstop=1 THEN RETURN 0
  985. waitchar=getinput(1 1 pen3'   Q=Quit   N=Non-Stop   RETURN=Continue  'def)
  986. IF waitchar='N' THEN
  987.   DO
  988.     nonstop=1
  989.     SAY lineup||pen3'To EXIT non-stop scrolling of text, press CTRL-E        'def||CR
  990.     SAY CR
  991.     CALL DELAY(100)
  992.     waitchar=''
  993.   END
  994. CALL cleanline(1)
  995. CALL checkdcd()
  996. IF waitchar='Q' THEN RETURN 1
  997. RETURN 0
  998.  
  999.  
  1000. cleanline:
  1001. ARG lflag .
  1002. IF colorflag~=1 & lflag=1 THEN RETURN
  1003. cline=lineup||LEFT(' ',78)
  1004. IF lflag=1 THEN cline=cline||lineup
  1005. SAY cline||CR
  1006. RETURN
  1007.  
  1008.  
  1009. getinput:
  1010. PARSE ARG upflag' 'oneflag' 'pline
  1011. CALL checkdcd()
  1012. OPTIONS PROMPT pline
  1013. PARSE PULL inarg
  1014. inarg=STRIP(inarg)
  1015. IF upflag THEN inarg=UPPER(inarg)
  1016. IF oneflag THEN inarg=LEFT(inarg,1)
  1017. inarg=cleanstring(0':'inarg)
  1018. RETURN inarg
  1019.  
  1020.  
  1021. docity:
  1022. PARSE ARG citi
  1023. citi=TRANSLATE(citi,'          ','+-.,*/()<>')
  1024. DO i=WORDS(citi) TO 1 BY -1
  1025.   IF DATATYPE(WORD(citi,i),'N') THEN citi=STRIP(DELWORD(citi,i,1))
  1026.   IF UPPER(WORD(citi,i))='USA' THEN citi=STRIP(DELWORD(citi,i,1))
  1027. END
  1028. citi=SPACE(citi,1)
  1029. RETURN STRIP(citi)
  1030.  
  1031.  
  1032. postuser:
  1033. IF bbsprefs.12~=1 THEN RETURN
  1034. ARG upflag .
  1035. IF upflag=6 THEN ptext='Logoff:' DATE() TIME('C')'  'name city
  1036. ELSE IF upflag=7 THEN ptext=name'  is a NEW USER!'
  1037. ELSE ptext=name city'  On:' logontime'  Last On:' DATE(,lastondate,'I')
  1038. ptext=CENTER(ptext,74)'\'
  1039. age='?'
  1040. IF UPPER(WORD(data.12,3))='BIRTHDAY:' THEN
  1041.   DO
  1042.     IF DATATYPE(WORD(data.12,4),'W') THEN
  1043.       DO
  1044.         age=LEFT(DATE('S'),4)-LEFT(WORD(data.12,4),4)
  1045.         IF SUBSTR(DATE('S'),5,2)<SUBSTR(WORD(data.12,4),5,2) THEN age=age-1
  1046.       END
  1047.   END
  1048. IF age='?' & WORD(data.12,4)~='' THEN age=WORD(data.12,4)
  1049. ptext2='Baud:' bps'   Age:' age'   Usage:' data.19
  1050. IF chatrequest=1 THEN ptext2=ptext2' - CHAT REQUEST!'
  1051. ptext=ptext||CENTER(ptext2,74)'\'
  1052. ulb=WORD(data.14,3)
  1053. IF ~DATATYPE(ulb,'W') | ulb=0 THEN ulb=1
  1054. dlb=WORD(data.15,3)
  1055. IF ~DATATYPE(dlb,'W') THEN dlb=0
  1056. dlup=TRUNC(dlb/ulb+.005,2)
  1057. line3='Level: 'level'   dl/ul:' dlup
  1058. IF upflag=0 THEN ptext=ptext||CENTER(line3,74)
  1059. IF upflag=1 THEN ptext=ptext||CENTER(line3'   Cmd:' opt arg,74)
  1060. IF upflag=2 THEN ptext=ptext||CENTER(line3'   MSG:' msg.msgdir,74)
  1061. IF upflag=3 THEN ptext=ptext||CENTER(line3'   Email',74)
  1062. IF upflag=4 THEN ptext=ptext||CENTER(line3'   ul:' arg 'in' plaindir,74)
  1063. IF upflag=5 THEN ptext=ptext||CENTER(line3'   dl:' arg 'in' plaindir,74)
  1064. IF upflag=6 THEN
  1065.   DO
  1066.     line3=line3'   Elapsed:'elapsed' '
  1067.     IF EXISTS(bbspath'Email/'sysop'/NEW_FILES') THEN line3=line3 'NEW_FILES'
  1068.     IF EXISTS(bbspath'Lists/NEW_USERS') THEN line3=line3 'NEW_USERS'
  1069.     ptext=ptext||CENTER(line3,74)
  1070.   END
  1071. IF GETCLIP('BBS_fkeyhelp')=1 THEN CALL PostMsg(3,11,ptext)
  1072. ELSE CALL PostMsg(lpost,rpost,ptext)
  1073. RETURN
  1074.  
  1075.  
  1076. whodat:
  1077. MSG RIGHT(' ',66-LENGTH(name)) '1B'x'M'||''||''||' 'name' level 'level' '||''
  1078. RETURN
  1079.  
  1080.  
  1081. showtime:
  1082. mins=TIME('E')%60
  1083. secs=TRUNC(TIME('E')//60)+1
  1084. IF secs>59 THEN secs=59
  1085. IF secs<10 THEN secs='0'secs
  1086. line=' Time:  Used' mins':'secs
  1087. mins=(maxtime-TIME('E'))%60
  1088. secs=TRUNC((maxtime-TIME('E'))//60)
  1089. IF secs<10 THEN secs='0'secs
  1090. line=line'   Remaining' mins':'secs
  1091. SAY line||CR
  1092.  
  1093. checktime:
  1094. IF TIME('E')>maxtime THEN
  1095.   DO
  1096.     SAY 'Sorry,' name 'your time has expired.'CR
  1097.     CALL send2log('*** Time Expired ***')
  1098.     SIGNAL LOGOUT2
  1099.   END
  1100. IF TIME('E')>(maxtime-120) THEN SAY '*** Less than 2 minutes left! ***'CR
  1101. CALL whodat()
  1102. CALL checkdcd()
  1103. RETURN
  1104.  
  1105.  
  1106. setdir:
  1107. PARSE ARG tempdir
  1108. CALL PRAGMA('D',STRIP(tempdir))
  1109. directory=PRAGMA('D')
  1110. Data directory
  1111. slash=LASTPOS('/',directory)
  1112. IF slash=0 THEN slash=LASTPOS(':',directory)
  1113. plaindir=directory
  1114. IF slash>0 THEN plaindir=SUBSTR(plaindir,slash+1)
  1115. RETURN
  1116.  
  1117.  
  1118. config:
  1119. arg='s:CONFIG.BBS'
  1120. IF ~EXISTS(arg) THEN arg='BBS:BBS_TEXT/CONFIG.BBS'
  1121. IF readlines(arg 1) THEN
  1122.   DO
  1123.     SAY 's:CONFIG.BBS and BBS:BBS_TEXT/CONFIG.BBS are both missing!'CR
  1124.     SIGNAL DONE2
  1125.   END
  1126. compos=POS('/*',lynes.1)
  1127. IF compos>0 THEN lynes.1=LEFT(lynes.1,compos-1)
  1128. bbsname=STRIP(lynes.1)
  1129. sysop=WORD(lynes.2,1)
  1130. compos=POS('/*',lynes.3)
  1131. IF compos>0 THEN lynes.3=LEFT(lynes.3,compos-1)
  1132. exclusion=STRIP(lynes.3)
  1133. bbsdevice=WORD(lynes.4,1)
  1134. sysoplevel=WORD(lynes.5,1)
  1135. bbspath=WORD(lynes.6,1)
  1136. IF ~EXISTS(bbspath) THEN
  1137.   DO
  1138.     SAY bbspath 'does not exist!'CR
  1139.     SIGNAL DONE2
  1140.   END
  1141. testchar=RIGHT(bbspath,1)
  1142. IF testchar~='/' & testchar~=':' THEN bbspath=bbspath'/'
  1143. CALL SETCLIP('BBS_path',bbspath)
  1144. msgpath=WORD(lynes.7,1)
  1145. IF ~EXISTS(msgpath) THEN
  1146.   DO
  1147.     SAY msgpath 'does not exist!'CR
  1148.     SIGNAL DONE2
  1149.   END
  1150. testchar=RIGHT(msgpath,1)
  1151. IF testchar~='/' & testchar~=':' THEN msgpath=msgpath'/'
  1152. CALL SETCLIP('BBS_msgpath',msgpath)
  1153. msgpath=msgpath'MSG'
  1154. libpath=WORD(lynes.8,1)
  1155. IF ~EXISTS(libpath) THEN
  1156.   DO
  1157.     SAY libpath 'does not exist!'CR
  1158.     SIGNAL DONE2
  1159.   END
  1160. testchar=RIGHT(libpath,1)
  1161. IF testchar~='/' & testchar~=':' THEN libpath=libpath'/'
  1162. CALL SETCLIP('BBS_libpath',libpath)
  1163. extdevs=''
  1164. DO i=1 TO WORDS(lynes.10)
  1165.   test=WORD(lynes.10,i)
  1166.   IF POS(':',test)=0 THEN ITERATE i
  1167.   IF LEFT(test,2)='/*' THEN LEAVE i
  1168.   extdevs=STRIP(extdevs test)
  1169. END
  1170. SYSTEM_MSG_LIMIT=WORD(lynes.11,1)
  1171. SYSTEM_SPACE_LIMIT=WORD(lynes.12,1)
  1172. maxidle=WORD(lynes.13,1)
  1173. maxtime=WORD(lynes.14,1)
  1174. maxbps=WORD(lynes.15,1)
  1175. IF ~DATATYPE(maxbps,'W') THEN maxbps=2400
  1176. CALL SETCLIP('BBS_baud',maxbps)
  1177. DO i=16 TO 31
  1178.   j=i-15
  1179.   bbsprefs.j=STRIP(WORD(lynes.i,1))
  1180. END
  1181. spellpath=WORD(lynes.9,1)
  1182. IF bbsprefs.5 & ~EXISTS(spellpath) THEN
  1183.   DO
  1184.     SAY spellpath 'does not exist!'CR
  1185.     bbsprefs.5=0
  1186.   END
  1187. IF bbsprefs.10 THEN scratch=bbspath'Scratch'
  1188. ELSE scratch='RAM:Scratch'
  1189. CALL MAKEDIR(scratch)
  1190. IF ~DATATYPE(bbsprefs.16,'W') THEN bbsprefs.16=3
  1191. extension=WORD(lynes.32,1)
  1192. arccom=lynes.33
  1193. compos=POS('/*',lynes.33)
  1194. IF compos>0 THEN lynes.33=LEFT(lynes.33,compos-1)
  1195. arccom=STRIP(lynes.33)
  1196. IF LEFT(extension,1)~='.' THEN
  1197.   DO
  1198.     extension='.lzh'
  1199.     arccom='lharc -m m'
  1200.   END
  1201. lpost=WORD(lynes.34,1)
  1202. IF ~DATATYPE(lpost,'W') THEN lpost=3
  1203. rpost=WORD(lynes.35,1)
  1204. IF ~DATATYPE(rpost,'W') THEN rpost=14
  1205. RETURN
  1206.  
  1207.  
  1208. readlogs:
  1209. IF arg='' THEN
  1210.   arg=getinput(1 0 '['pen3'RETURN'def']=TODAY, or enter Log Date ('pen3||DATE('S')||def') > ')
  1211. IF arg='' THEN arg=DATE('S')
  1212. arg=bbspath'Logs/log.'arg
  1213. CALL readlines(arg 1)
  1214. CALL seelines(0)
  1215. nonstop=0
  1216. CALL waiting()
  1217. RETURN
  1218.  
  1219.  
  1220. loadcourtesy:
  1221. IF courtesyflag=0 & courtesy='' & EXISTS(bbspath'Lists/Courtesy') THEN
  1222.   DO
  1223.     IF readopen(bbspath'Lists/Courtesy') THEN
  1224.       DO
  1225.         SAY 'Checking Courtesy List...'CR
  1226.         DO i=1
  1227.           line=READLN(f)
  1228.           IF EOF(f) THEN BREAK
  1229.           line=cleanstring(1':'line)
  1230.           courtesy=courtesy line
  1231.         END
  1232.         CALL CLOSE(f)
  1233.         MSG ''
  1234.         MSG pen3'Courtesy List:'def
  1235.         MSG courtesy
  1236.       END
  1237.   END
  1238. RETURN
  1239.  
  1240.  
  1241. fileheader:
  1242. SAY 'Filename          Bytes File# Library         KeyWords'CR
  1243. SAY pen3||LEFT('=',77,'=')||def||CR
  1244. RETURN
  1245.  
  1246.  
  1247. showalpha:
  1248. IF DATATYPE(arg,'W') THEN
  1249.   DO
  1250.     dirnum=arg
  1251.     arg=''
  1252.     IF chdir2()>0 THEN RETURN
  1253.     test='Y'
  1254.   END
  1255. ELSE
  1256.   DO
  1257.     test=getinput(1 1 'Show one library only? (Ny) > ')
  1258.     IF test='Y' THEN
  1259.       IF chdir()>0 THEN RETURN
  1260.   END
  1261.  
  1262. showalpha2:
  1263. IF test='Y' THEN filecount=WORDS(SHOWDIR(bbspath'FileNotes/'plaindir))
  1264. ELSE filecount=files.0
  1265. SAY '  'filecount 'files.'CR
  1266. CALL fileheader()
  1267. count=0
  1268. DO shi=1 TO alpha.0
  1269.   IF test='Y' THEN
  1270.     DO
  1271.       IF count>=filecount THEN LEAVE shi
  1272.       IF UPPER(LEFT(plaindir,12))~=UPPER(LEFT(WORD(alpha.shi,5),12)) THEN
  1273.         ITERATE shi
  1274.     END
  1275.   jj=WORD(alpha.shi,4)
  1276.   IF jj>level | FIND(data.21,UPPER(dirs.jj))>0 THEN
  1277.     ITERATE shi
  1278.   SAY alpha.shi||CR
  1279.   count=count+1
  1280.   IF (count+2)//linesperpage=0 THEN
  1281.     IF waiting2() THEN LEAVE shi
  1282. END
  1283. nonstop=0
  1284. IF waitchar~='Q' THEN CALL waiting()
  1285. RETURN
  1286.  
  1287.  
  1288. profiles:
  1289. prodir=bbspath'Profiles'
  1290. CALL MAKEDIR(prodir)
  1291. pros=SHOWDIR(prodir)
  1292. protxt=bbspath'BBS_TEXT/PROFILES'
  1293. IF EXISTS(protxt) THEN CALL showtext(protxt)
  1294. DO lupe=1
  1295.   SAY CR
  1296.   SAY '       1. Edit 'name'''s user Profile'CR
  1297.   SAY '       2. View a User Profile'CR
  1298.   SAY '       3. Search User Profiles'CR
  1299.   SAY '       4. Browse User Profiles'CR
  1300.   SAY CR
  1301.   temp=getinput(1 1 'Enter Selection Number > ')
  1302.   IF temp=1 THEN
  1303.     DO
  1304.       lynes.=''
  1305.       IF EXISTS(prodir'/'name) THEN
  1306.         DO
  1307.           IF readlines(prodir'/'name 1)~=0 THEN ITERATE lupe
  1308.           CALL DELETE(prodir'/'name)
  1309.         END
  1310.       ELSE lynes.0=3
  1311.       lynes.1=name
  1312.       lynes.2='Profile Last Updated:' DATE('W') DATE() TIME('C')
  1313.       lynes.3=LEFT('=',74,'=')
  1314.       IF savelines(prodir'/'name)~=0 THEN
  1315.         DO
  1316.           line='Profile for' name 'failed to save!'
  1317.           SAY line||CR
  1318.           CALL send2log(line)
  1319.           ITERATE lupe
  1320.         END
  1321.       edtype=''
  1322.       CALL bbsEd(4 prodir'/'name)
  1323.       IF readlines(prodir'/'name 1)~=0 THEN CALL DELETE(prodir'/'name)
  1324.       IF lynes.0<4 THEN CALL DELETE(prodir'/'name)
  1325.       pros=SHOWDIR(prodir)
  1326.     END
  1327.   ELSE IF temp=2 THEN
  1328.     DO pf=1
  1329.       totpros=WORDS(pros)
  1330.       DO pfl=1 TO totpros BY 3
  1331.         pfl2=pfl+1
  1332.         pfl3=pfl+2
  1333.         pfline=pen3||RIGHT(pfl,3)||def LEFT(WORD(pros,pfl),21)
  1334.         IF pfl2<=totpros THEN
  1335.           pfline=pfline pen3||RIGHT(pfl2,3)||def LEFT(WORD(pros,pfl2),21)
  1336.         IF pfl3<=totpros THEN
  1337.           pfline=pfline pen3||RIGHT(pfl3,3)||def LEFT(WORD(pros,pfl3),21)
  1338.         SAY pfline||CR
  1339.         IF nonstop~=1 & ((pfl3%3)//linesperpage)=0 THEN
  1340.           IF waiting(2) THEN LEAVE pfl1
  1341.       END
  1342.       emnum=getinput(1 0 pen3'Select User Profile Number > 'def)
  1343.       IF DATATYPE(emnum,'W') & emnum>0 & emnum<=totpros THEN
  1344.         DO
  1345.           tmp=WORD(pros,emnum)
  1346.           IF level>sysoplevel THEN
  1347.             DO
  1348.               CALL bbsEd(1 prodir'/'tmp)
  1349.               IF readlines(prodir'/'tmp 1)~=0 THEN CALL DELETE(prodir'/'tmp)
  1350.               IF lynes.0<4 THEN CALL DELETE(prodir'/'tmp)
  1351.               pros=SHOWDIR(prodir)
  1352.             END
  1353.           ELSE CALL showtext(prodir'/'tmp)
  1354.         END
  1355.       ELSE LEAVE pf
  1356.     END
  1357.   ELSE IF temp=3 | temp=4 THEN
  1358.     DO
  1359.       searcharg=''
  1360.       nonstop=0
  1361.       IF temp=3 THEN
  1362.         DO
  1363.           searcharg=STRIP(getinput(0 0 'Enter Search Phrase > '))
  1364.           IF searcharg='' THEN ITERATE lupe
  1365.         END
  1366.       DO ui=1 TO WORDS(pros)
  1367.         pro=prodir'/'WORD(pros,ui)
  1368.         IF temp=3 THEN
  1369.           IF textsearch(pro searcharg)=0 THEN ITERATE ui
  1370.         SAY CR
  1371.         CALL readlines(pro 1)
  1372.         IF nonstop=1 THEN rnonstop=1
  1373.         ELSE rnonstop=0
  1374.         CALL seelines(2)
  1375.         IF rnonstop THEN nonstop=1
  1376.         ELSE IF waiting2()=1 THEN LEAVE ui
  1377.         SAY CR
  1378.         SAY CR
  1379.       END
  1380.     END
  1381.   ELSE IF temp='' | LEFT(temp,1)='Q' THEN LEAVE lupe
  1382. END
  1383. DROP pros
  1384. RETURN
  1385.  
  1386.  
  1387. otheruser:
  1388. line=''
  1389. IF level>sysoplevel THEN line='['pen3'R'def']eport or'
  1390. line=line '['pen3'D'def']etails or simple ['pen3'N'def']amelist?'
  1391. IF level>sysoplevel THEN line=line '(Dnr) > '
  1392. ELSE line=line '(Dn) > '
  1393. temp=getinput(1 1 line)
  1394. IF temp='N' THEN
  1395.   DO
  1396.     CALL showuserlist()
  1397.     RETURN
  1398.   END
  1399. ELSE IF level>sysoplevel & temp='R' THEN
  1400.   DO
  1401.     SAY CR
  1402.     line=''
  1403.     IF getinput(1 1 'Report on inactive users? (nY) > ')~='N' THEN
  1404.       DO
  1405.         CALL cleanline(0)
  1406.         SAY 'INACTIVE_USERS report will be in your email.'CR
  1407.         line='USERS '
  1408.       END
  1409.     IF getinput(1 1 'Report on actual files vs. filelists? (nY) > ')~='N' THEN
  1410.       DO
  1411.         CALL cleanline(0)
  1412.         line=line'FILES'
  1413.         line=STRIP(line getinput(1 0 'Report only files larger than (0) bytes > '))
  1414.         SAY 'FILELISTS_REPORT will be in your email.'CR
  1415.       END
  1416.     SAY CR
  1417.     ADDRESS AREXX bbsREPORT.rexx name line 
  1418.     RETURN
  1419.   END
  1420. SAY CR
  1421. SAY 'To allow (or not) other users to see your street address and/or phone number,'CR
  1422. SAY 'add (or delete) STREET and/or PHONE to the line 8 list in ['pen3'Y'def']our userfile.'CR
  1423. SAY CR
  1424. SAY 'User specification may include ? wildcard for single characters.'CR
  1425. SAY 'ie,' pen3's?n'def 'will return all user names containing ''son'', ''sen'', ''sin'', etc.'CR
  1426. IF arg='' THEN arg=getinput(1 0 pen3'User specification: 'def)
  1427. IF arg='' THEN RETURN
  1428. arg=TRANSLATE(STRIP(arg),'_',' ')
  1429. CALL FileList(bbspath'Users/*'arg'*',wildlist)
  1430. line='Found' wildlist.0 'match'
  1431. IF wildlist.0~=1 THEN line=line'es'
  1432. SAY line'.'CR
  1433. IF wildlist.0<1 THEN RETURN
  1434. totlines=0
  1435. nextpagebreak=linesperpage-3
  1436. extrainfo=0
  1437. IF level>sysoplevel THEN
  1438.   DO
  1439.     IF getinput(1 1 'Display -sysop only- information? (nY) > ')~='N' THEN
  1440.       extrainfo=1
  1441.   END
  1442. DO i=1 TO wildlist.0
  1443.   CALL readlines(wildlist.i 1)
  1444.   SAY CR
  1445.   totlines=totlines+6
  1446.   SAY bak2' 'SUBSTR(wildlist.i,LASTPOS('/',wildlist.i)+1)' 'def||CR
  1447.   SAY lynes.1||CR
  1448.   IF FIND(UPPER(lynes.8),'STREET')>0 THEN
  1449.     DO
  1450.       totlines=totlines+1
  1451.       SAY lynes.2||CR
  1452.     END
  1453.   SAY lynes.3||CR
  1454.   IF FIND(UPPER(lynes.8),'PHONE')>0 THEN
  1455.     DO
  1456.       totlines=totlines+1
  1457.       SAY lynes.4||CR
  1458.     END
  1459.   SAY 'Last time on' bbsname':' DATE(,WORD(lynes.13,1),'S') WORD(lynes.13,2)||CR
  1460.   SAY pen3'Interests:'def lynes.10||CR
  1461.   IF extrainfo THEN
  1462.     DO
  1463.       SAY pen3'   up:'def lynes.14||CR
  1464.       SAY pen3' down:'def lynes.15||CR
  1465.       temptot=0
  1466.       DO j=1 TO WORDS(lynes.23)
  1467.         IF DATATYPE(WORD(lynes.23,j),'W') THEN temptot=temptot+WORD(lynes.23,j)
  1468.       END
  1469.       SAY pen3' writ:'def temptot 'public messages.'CR
  1470.       SAY pen3'level:'def lynes.20||CR
  1471.       totlines=totlines+4
  1472.       IF lynes.21~='' THEN
  1473.         DO
  1474.           totlines=totlines+1
  1475.           SAY pen3'excluded dirs:'def lynes.21||CR
  1476.         END
  1477.     END
  1478.   IF nonstop~=1 & totlines>=nextpagebreak THEN
  1479.     DO
  1480.       IF waiting2() THEN LEAVE i
  1481.       nextpagebreak=totlines+linesperpage-5
  1482.     END
  1483. END
  1484. nonstop=0
  1485. DROP wildlist.
  1486. IF waitchar~='Q' THEN CALL waiting()
  1487. RETURN
  1488.  
  1489.  
  1490. changename:
  1491. ARG cname
  1492. IF level<=sysoplevel THEN RETURN
  1493. IF cname='' THEN cname=getinput(1 0 'Current Username (include underscore): ')
  1494. IF readlines(bbspath'Users/'cname 1)>0 THEN RETURN
  1495. IF WORD(lynes,20)>=level THEN RETURN
  1496. CALL SETCLIP('BBS_oldname',cname)
  1497. CALL ChangeUserName.rexx()
  1498. IF GETCLIP('BBS_oldname')='' THEN CALL send2log('Name Change:' cname)
  1499. cname=GETCLIP('BBS_newname')
  1500. CALL DELETE(bbspath'Lists/USERS')
  1501. sortuserflag=1
  1502. CALL SETCLIP('BBS_oldname')
  1503. CALL SETCLIP('BBS_newname')
  1504. RETURN cname
  1505.  
  1506.  
  1507. levelreport:
  1508. minlev=0
  1509. maxlev=99
  1510. templist=''
  1511. uname=''
  1512. newufile=bbspath'Lists/NEW_USERS'
  1513. IF EXISTS(newufile) THEN
  1514.   DO
  1515.     IF getinput(1 1 'Latest New Users Only? (nY) > ')~='N' THEN
  1516.       DO
  1517.         IF readlines(newufile 1)=0 THEN
  1518.           DO i=2 TO lynes.0
  1519.             templist=STRIP(templist WORD(lynes.i,5))
  1520.           END
  1521.       END
  1522.     ELSE newufile=''
  1523.   END
  1524. ELSE newufile=''
  1525. IF newufile='' THEN
  1526.   DO
  1527.     minlev=getinput(1 0 'Minimum level? (0) > ')
  1528.     maxlev=getinput(1 0 'Maximum level? (99) > ')
  1529.     IF ~DATATYPE(minlev,'W') THEN minlev=0
  1530.     IF ~DATATYPE(maxlev,'W') THEN maxlev=99
  1531.     IF minlev<0 | minlev>99 THEN minlev=0
  1532.     IF maxlev<0 | maxlev>99 THEN maxlev=99
  1533.     templist=userlist
  1534.   END
  1535. DO levi=1 TO WORDS(templist)
  1536.   arg=bbspath'Users/'WORD(templist,levi)
  1537.   CALL readlines(arg 1)
  1538.   IF lynes.20<minlev | lynes.20>maxlev THEN ITERATE levi
  1539.   line=lynes.20 WORD(templist,levi)
  1540.   SAY line||CR
  1541.   IF newufile~='' | WORD(lynes.20,1)<10 | ~DATATYPE(WORD(lynes.20,1),'W') THEN
  1542.     DO
  1543.       SAY CR||LF||line||CR
  1544.       DO levj=1 TO 12
  1545.         SAY pen3'  'lynes.levj||def||CR
  1546.       END
  1547.       SAY pen3'  'lynes.19||def||CR
  1548.     END
  1549.   IF ~DATATYPE(WORD(lynes.20,1),'W') | WORD(lynes.20,1)<10 THEN
  1550.     DO
  1551.       lcom=getinput(1 1 '['pen3'A'def']dd or ['pen3'K'def']ill or ['pen3'R'def']ename or ['pen3'S'def']kip this user? (Akrs) > ')
  1552.       CALL cleanline(0)
  1553.       IF lcom='K' THEN
  1554.         DO
  1555.           arg=WORD(templist,levi)
  1556.           CALL killuser()
  1557.         END
  1558.       ELSE IF lcom='R' THEN
  1559.         DO
  1560.           newname=changename(WORD(templist,levi))
  1561.           IF newname~='' & newname~=WORD(templist,levi) THEN
  1562.             DO
  1563.               temp=WORDINDEX(templist,levi+1)
  1564.               rtemp=''
  1565.               IF temp>0 THEN rtemp=SUBSTR(templist,temp)
  1566.               temp=WORDINDEX(templist,levi)
  1567.               templist=''
  1568.               IF temp>1 THEN templist=STRIP(LEFT(templist,temp-1))
  1569.               templist=STRIP(templist newname rtemp)
  1570.               userlist=userlist newname
  1571.             END
  1572.           levi=levi-1
  1573.           CALL SETCLIP('BBS_newname')
  1574.         END
  1575.       ELSE IF lcom~='S' THEN
  1576.         DO
  1577.           IF readopen(bbspath'BBS_TEXT/DEF.MEMBER') THEN
  1578.             DO
  1579.               DO lvi=1 TO 21
  1580.                 line=READLN(f)
  1581.                 IF lvi=11 THEN lynes.11=line
  1582.                 IF lvi=20 THEN lynes.20=line
  1583.               END
  1584.               lynes.21=line
  1585.               CALL CLOSE(f)
  1586.               edtype=''
  1587.               CALL savelines(arg)
  1588.               SAY lynes.20 WORD(templist,levi) 'has been made a member.'CR
  1589.             END
  1590.           ELSE SAY 'You need a default member file in BBS_TEXT!  ( BBS_TEXT/DEF.MEMBER )'CR
  1591.         END
  1592.       IF lcom~='K' & lcom~='R' THEN CALL writenew()
  1593.     END
  1594.   ELSE IF newufile~='' THEN CALL writenew()
  1595. END
  1596. IF newufile~='' THEN CALL DELETE(newufile)
  1597. DROP templist
  1598. RETURN
  1599.  
  1600.  
  1601. writenew:
  1602. arg=WORD(templist,levi)
  1603. IF getinput(1 1 'Write' arg 'an email message? (nY) > ')~='N' THEN
  1604.   DO
  1605.     IF EXISTS(bbspath'BBS_TEXT/EMAIL_WELCOME') THEN
  1606.       IF getinput(1 1 'Use default welcome? (nY) > ')~='N' THEN replysubj='|@NEW@|'
  1607.     CALL editor('MAIL' arg)
  1608.   END
  1609. RETURN
  1610.  
  1611.  
  1612. filereport:
  1613. SAY 'Searching for mismatches between files and filenotes...'CR
  1614. DO i=1 TO sysoplevel+1
  1615.   IF dirs.i='' THEN ITERATE
  1616.   SAY dirs.i'                               'lineup||CR
  1617.   rfiles=SHOWDIR(libpath||dirs.i)
  1618.   rnotes=SHOWDIR(bbspath'FileNotes/'dirs.i)
  1619.   IF WORDS(rfiles)~=WORDS(rnotes) THEN
  1620.     DO
  1621.       line='Compare files & filenotes in'pen3 dirs.i||def'. '
  1622.       DO j=1 TO WORDS(rfiles)
  1623.         IF FIND(UPPER(rnotes),UPPER(WORD(rfiles,j)))=0 THEN
  1624.           line=line WORD(rfiles,j)
  1625.       END
  1626.       SAY line||CR
  1627.     END
  1628. END
  1629. Send '^G'
  1630. CALL waiting()
  1631. RETURN
  1632.  
  1633.  
  1634. mailreport:
  1635. SAY 'Checking ALL pending Email...'CR
  1636. SAY pen3' - Use CTRL-E to Exit -'def||CR
  1637. SAY CR
  1638. mailrep=SHOWDIR(bbspath'Email','D')
  1639. mailfil=SHOWDIR(bbspath'EmailFiles','D')
  1640. lastemail=WORD(data.17,3)
  1641. IF ~DATATYPE(lastemail,'W') THEN lastemail=0
  1642. IF lastemail=countcheck(bbspath'Numbers/LastMail' 0) THEN
  1643.   DO
  1644.     DROP mailrep. mailfil.
  1645.     RETURN
  1646.   END
  1647. mailynes.=''
  1648. mk=0
  1649. DO mi=1 TO WORDS(mailrep)
  1650.   muser=WORD(mailrep,mi)
  1651.   IF muser=sysop | muser=name THEN ITERATE mi
  1652.   mlist=SHOWDIR(bbspath'Email/'muser)
  1653.   IF WORDS(mlist)>0 THEN SAY lineup||RIGHT(muser,40)||CR
  1654.   DO mj=1 TO WORDS(mlist)
  1655.     fuser=WORD(mlist,mj)
  1656.     IF POS(sysop,fuser)>0 THEN ITERATE mj
  1657.     IF logonflag=0 THEN
  1658.       DO
  1659.         mk=mk+1
  1660.         mailynes.mk=pen3||LEFT(muser,20) 'from'def LEFT(fuser,20) DATE(,WORD(STATEF(bbspath'Email/'muser'/'fuser),5),'I')
  1661.       END
  1662.     IF POS(sysop,fuser)=0 & POS(name,fuser)=0 THEN
  1663.       DO
  1664.         testnum=RIGHT(fuser,LENGTH(fuser)-LASTPOS('.',fuser))
  1665.         IF testnum>emailnum THEN emailnum=testnum
  1666.         IF testnum>lastemail THEN
  1667.           DO
  1668.             CALL showtext(bbspath'Email/'muser'/'fuser)
  1669.             SAY CR
  1670.             SAY CR
  1671.             IF waitchar='Q' THEN LEAVE mi
  1672.           END
  1673.       END
  1674.   END
  1675.   IF logonflag=0 & FIND(mailfil,muser)>0 THEN
  1676.     DO
  1677.       efilelist=SHOWDIR(bbspath'EmailFiles/'muser)
  1678.       IF WORDS(efilelist)>0 THEN
  1679.         DO
  1680.           mk=mk+1
  1681.           mailynes.mk=pen3||LEFT(muser,20) 'emailfiles'def efilelist
  1682.         END
  1683.     END
  1684. END
  1685. data.17=WORD(data.17,1) WORD(data.17,2) countcheck(bbspath'Numbers/LastMail' 0)
  1686. IF mk>0 THEN
  1687.   DO
  1688.     lynes.0=mk
  1689.     DO mi=1 TO mk
  1690.       lynes.mi=mailynes.mi
  1691.     END
  1692.     CALL seelines(1)
  1693.     nonstop=0
  1694.     CALL waiting()
  1695.   END
  1696. ELSE SAY 'No unseen Email pending.'CR
  1697. DROP mailrep. mailfil. mailynes. mlist
  1698. RETURN
  1699.  
  1700.  
  1701. jump2rexx:
  1702. IF ~DATATYPE(jdoors.0,'W') THEN doors.0=0
  1703. IF WORDS(SHOWDIR(bbspath'rexxDoors','F'))~=doors.0 THEN
  1704.   DO
  1705.     jdoors.=''
  1706.     doorlist=SHOWDIR(bbspath'rexxDoors','F')
  1707.     doors.=''
  1708.     doors.0=WORDS(doorlist)
  1709.     DO i=1 TO doors.0
  1710.       doors.i=WORD(doorlist,i)
  1711.     END
  1712.     SAY 'Sorting..'lineup||CR
  1713.     CALL QSORT(1,doors.0,doors)
  1714.     jdoors.0=doors.0%3
  1715.     IF (doors.0//3)>0 THEN jdoors.0=jdoors.0+1
  1716.     DO i=1 TO jdoors.0
  1717.       jdoors.i=LEFT(RIGHT(i,3)'.' LEFT(doors.i,LENGTH(doors.i)-5),24)
  1718.       DO j=1 TO 2
  1719.         k=i+j*jdoors.0
  1720.         IF k<=doors.0 THEN
  1721.           jdoors.i=jdoors.i' 'LEFT(RIGHT(k,3)'.' LEFT(doors.k,LENGTH(doors.k)-5),24)
  1722.       END
  1723.     END
  1724.   END
  1725. DO doorloop=1
  1726.   SAY pen3||LEFT('-',75,'-')||def||CR
  1727.   DO jd=1 TO jdoors.0
  1728.     SAY jdoors.jd||CR
  1729.     IF jd//linesperpage=0 THEN CALL waiting()
  1730.     IF waitchar='Q' THEN RETURN
  1731.   END
  1732.   temp=getinput(1 0 pen3'Select Application Number > 'def)
  1733.   IF ~DATATYPE(temp,'W') | temp<1 | temp>doors.0 THEN RETURN
  1734.   arg=doors.temp
  1735.   CALL postuser(1)
  1736.   curdir=PRAGMA('D')
  1737.   CALL setdir(bbspath'rexxDoors')
  1738.   CALL send2log('Door: 'doors.temp 'at' TIME('C'))
  1739.   CALL SETCLIP('BBS_winnings')
  1740.   savewinnings=0
  1741.   timeleft=TRUNC(maxtime-TIME('E'))
  1742.   IF UPPER(doors.temp)='ONE_ARMED_BANDIT.REXX' THEN
  1743.     IF getinput(1 1 'Play for this sessions time in seconds? (Ny) > ')='Y' THEN
  1744.       DO
  1745.         savewinnings=winnings
  1746.         IF savewinnings=0 THEN savewinnings=1
  1747.         winnings=timeleft
  1748.         SAY 'Playing for REAL seconds, not wimpy play-dollars!'CR
  1749.       END
  1750.   CALL SETCLIP('BBS_door_demon',timeleft)
  1751.   ADDRESS AREXX doorDemon.baud
  1752.   comm='SIGNAL OFF ERROR;SIGNAL OFF SYNTAX;'
  1753.   comm=comm'SIGNAL OFF FAILURE;SIGNAL OFF BREAK_C;SIGNAL OFF BREAK_E;'
  1754.   comm=comm'CALL' doors.temp'('name winnings savewinnings colorflag')'
  1755.   INTERPRET comm
  1756.   SIGNAL ON SYNTAX
  1757.   SIGNAL ON FAILURE
  1758.   SIGNAL ON BREAK_C
  1759.   testwin=GETCLIP('BBS_winnings')
  1760.   IF DATATYPE(testwin,'N') THEN
  1761.     DO
  1762.       IF savewinnings>0 THEN
  1763.         DO
  1764.           IF testwin>7200 THEN
  1765.             DO
  1766.               SAY 'Although you won' TRUNC(testwin/60) 'minutes, the maximum session time is 120 minutes.'CR
  1767.               testwin=7200
  1768.             END
  1769.           maxtime=TRUNC(testwin+TIME('E'))
  1770.           winnings=savewinnings
  1771.         END
  1772.       ELSE winnings=testwin
  1773.     END
  1774.   CALL setdir(curdir)
  1775.   CALL SETCLIP('BBS_winnings')
  1776.   IF SHOW('P','BBS_DOOR_DEMON') THEN CALL SETCLIP('BBS_door_demon','QUIT')
  1777.   SAY CR
  1778.   CALL showtime()
  1779. END
  1780. RETURN
  1781.  
  1782.  
  1783. sortlibraries:
  1784. SAY 'Sorting Libraries...'CR
  1785. count=0
  1786. sdirs.=''
  1787. DO i=1 TO level
  1788.   IF dirs.i='' THEN ITERATE i
  1789.   count=count+1
  1790.   sdirs.count=dirs.i i
  1791. END
  1792. sdirs.0=count
  1793. CALL QSort(1,count,sdirs)
  1794. count=0
  1795. libs.=''
  1796. DO i=1 TO sdirs.0
  1797.   tempnum=WORD(sdirs.i,2)
  1798.   tempdir=WORD(sdirs.i,1)
  1799.   IF FIND(data.21,UPPER(tempdir))=0 THEN
  1800.     DO
  1801.       string=' '
  1802.       IF tempnum<10 THEN string=string' '
  1803.       string=string || tempnum'. 'LEFT(tempdir,14)
  1804.       count=count+1
  1805.       libs.count=string
  1806.     END
  1807. END
  1808. libs.0=count%4
  1809. IF (count//4)>0 THEN libs.0=libs.0+1
  1810. DO i=1 TO libs.0
  1811.   DO j=1 TO 3
  1812.     k=i+j*libs.0
  1813.     IF k<=count THEN libs.i=libs.i||libs.k
  1814.   END
  1815. END
  1816. DROP sdirs.
  1817. CALL sortconferences()
  1818. RETURN
  1819.  
  1820.  
  1821. sortconferences:
  1822. SAY 'Sorting Conferences...'CR
  1823. count=0
  1824. smsg.=''
  1825. DO i=1 TO level
  1826.   IF msg.i='' THEN ITERATE i
  1827.   count=count+1
  1828.   smsg.count=msg.i i
  1829. END
  1830. smsg.0=count
  1831. CALL QSort(1,count,smsg)
  1832. count=0
  1833. msgs.=''
  1834. DO i=1 TO smsg.0
  1835.   tempnum=WORD(smsg.i,2)
  1836.   tempdir=WORD(smsg.i,1)
  1837.   IF FIND(data.21,tempnum)=0 THEN
  1838.     DO
  1839.       string=' '
  1840.       IF tempnum<10 THEN string=string' '
  1841.       string=string || tempnum'.'
  1842.       IF WORD(data.22,tempnum)='' | WORD(data.22,tempnum)>=0 THEN
  1843.         string=string LEFT(tempdir,20)
  1844.       ELSE string=string pen3'-OFF-'def LEFT(tempdir,14)
  1845.       count=count+1
  1846.       msgs.count=string
  1847.     END
  1848. END
  1849. msgs.0=count%3
  1850. IF (count//3)>0 THEN msgs.0=msgs.0+1
  1851. DO i=1 TO msgs.0
  1852.   DO j=1 TO 2
  1853.     k=i+j*msgs.0
  1854.     IF k<=count THEN msgs.i=msgs.i msgs.k
  1855.   END
  1856. END
  1857. DROP smsg.
  1858. RETURN
  1859.  
  1860.  
  1861. readmessages:
  1862. searcharg=''
  1863. DO FOREVER
  1864.   SAY CR
  1865.   PARSE VAR arg temp' 'arg .
  1866.   IF DATATYPE(temp,'W') THEN msgdir=temp
  1867.   ELSE IF LEFT(UPPER(temp),1)='A' THEN
  1868.     DO
  1869.       CALL newmsgs()
  1870.       arg=''
  1871.       RETURN
  1872.     END
  1873.   ELSE IF LEFT(UPPER(temp),1)='M' THEN
  1874.     DO
  1875.       CALL readmarked()
  1876.       arg=''
  1877.       RETURN
  1878.     END
  1879.   ELSE
  1880.     DO
  1881.       SAY 'Select Message Conference By Number, ['pen3'M'def']arked only or ['pen3'A'def']ll Active'CR
  1882.       IF areaselect() THEN
  1883.         DO
  1884.           IF LEFT(temp,1)='A' THEN CALL newmsgs()
  1885.           IF LEFT(temp,1)='M' THEN CALL readmarked()
  1886.           RETURN
  1887.         END
  1888.     END
  1889.   pline='['pen3'A'def']rchive ['pen3'S'def']earch ['pen3'T'def']oggle ON/OFF'
  1890.   pline=pline '['pen3'R'def']ead ['pen3'Q'def']uit (aqRst) > '
  1891.   IF arg~='' THEN junk=UPPER(LEFT(arg,1))
  1892.   ELSE junk=getinput(1 1 pline)
  1893.   IF junk='Q' THEN RETURN
  1894.   IF junk='A' THEN
  1895.     DO
  1896.       SAY CR
  1897.       CALL msgcount(msgdir)
  1898.       junk=getinput(1 0 pen3'RETURN'def' to archive new msgs, ['pen3'Q'def']uit, or enter starting message number > ')
  1899.       IF junk='Q' THEN RETURN
  1900.       IF DATATYPE(junk,'W') THEN
  1901.         DO
  1902.           IF junk>lastmess | junk<1 THEN junk=1
  1903.           lastread.msgdir=junk-1
  1904.           CALL savedata(1)
  1905.         END
  1906.       CALL SETCLIP('BBS_MSGS','ON')
  1907.       SAY 'Archiving messages in the'pen3 msg.msgdir def'Conference...'CR
  1908.       lastread.msgdir=countcheck(bbspath'Numbers/LastMessage'msgdir 0)
  1909.       CALL send2log('Arc: ArcMsgs.rexx' msg.msgdir)
  1910.       ADDRESS AREXX ArcMsgs.rexx name msgdir
  1911.       IF emailonline>=0 THEN emailonline=emailonline+1
  1912.       DO WHILE GETCLIP('BBS_MSGS')~=''
  1913.         CALL DELAY(14)
  1914.       END
  1915.       SAY 'When completed, the archive will be attached to email addressed to you.'CR
  1916.       CALL savedata(1)
  1917.       SAY CR
  1918.       RETURN
  1919.     END
  1920.   IF junk='S' THEN
  1921.     DO
  1922.       searcharg=''
  1923.       searcharg=getinput(0 0 pen3'Search Phrase: 'def)
  1924.       IF LENGTH(STRIP(searcharg))=0 THEN RETURN
  1925.       searcharg=COMPRESS(searcharg,'*')
  1926.       CALL searchmsgdir()
  1927.       searcharg=''
  1928.       RETURN
  1929.     END
  1930.   IF junk='T' THEN
  1931.     DO
  1932.       line='Turning the' msg.msgdir 'conference'
  1933.       IF WORD(data.22,msgdir)<0 THEN
  1934.         DO
  1935.           line=line pen3'ON'def'.'
  1936.           newdata='0'
  1937.         END
  1938.       ELSE
  1939.         DO
  1940.           line=line pen3'OFF'def'.'
  1941.           newdata='-1'
  1942.         END
  1943.       SAY line||CR
  1944.       dataloc=WORDINDEX(data.22,msgdir)-1
  1945.       data.22=DELWORD(data.22,msgdir,1)
  1946.       IF dataloc>0 THEN data.22=INSERT(newdata' ',data.22,dataloc)
  1947.       CALL sortconferences()
  1948.     END
  1949.   CALL readmsg(0)
  1950.   CALL saveData(1)
  1951.   nonstop=0
  1952.   arg=''
  1953. END
  1954. RETURN
  1955.  
  1956.  
  1957. newmsgs:
  1958. test=UPPER(LEFT(arg,1))
  1959. IF test='' THEN
  1960.   test=getinput(1 1 '['pen3'R'def']ead new messages or ['pen3'A'def']rchive for later download. (aR) > ')
  1961. IF test='A' THEN
  1962.   DO
  1963.     CALL SETCLIP('BBS_MSGS','ON')
  1964.     SAY CR
  1965.     SAY 'Archiving new conference messages...'CR
  1966.     CALL send2log('Arc: ArcMsgs.rexx')
  1967.     ADDRESS AREXX ArcMsgs.rexx name
  1968.     IF emailonline>=0 THEN emailonline=emailonline+1
  1969.     clear_marked=1
  1970.     DO i=1 TO level
  1971.       IF WORD(data.22,i)~=-1 THEN
  1972.         lastread.i=countcheck(bbspath'Numbers/LastMessage'i 0)
  1973.     END
  1974.     DO WHILE GETCLIP('BBS_MSGS')~=''
  1975.       CALL DELAY(14)
  1976.     END
  1977.     SAY 'When completed, the archive will be attached to email addressed to you.'CR
  1978.     CALL savedata(1)
  1979.     SAY CR
  1980.     RETURN
  1981.   END
  1982. curmsgdir=msgdir
  1983. SAY 'Scanning all Conferences for new messages..'CR
  1984. DO newi=1 TO level
  1985.   IF msg.newi='' THEN ITERATE newi
  1986.   msgdir=newi
  1987.   CALL readmsg(1)
  1988.   IF msgcom='Q' THEN LEAVE newi
  1989. END
  1990. CALL saveData(1)
  1991. msgdir=curmsgdir
  1992. nonstop=0
  1993. RETURN
  1994.  
  1995.  
  1996. readmsg:
  1997. ARG quietflag marknum .
  1998. msgcom=''
  1999. IF msg.msgdir='' | FIND(data.21,msgdir)>0 THEN RETURN; /* sysop excluded */
  2000. IF WORD(data.22,msgdir)=-1 THEN RETURN;                /* user  excluded */
  2001. entering='Entering'pen3 msg.msgdir def'Message Conference..'
  2002. IF quietflag=0 & marknum='' THEN SAY entering||CR
  2003. CALL postuser(2)
  2004. IF DATATYPE(WORD(data.22,msgdir),'W') THEN
  2005.   lastread.msgdir=WORD(data.22,msgdir)
  2006. ELSE lastread.msgdir=0
  2007. lstwrt=countcheck(bbspath'Numbers/LastMessage'msgdir 0)
  2008. frstwrt=countcheck(bbspath'Numbers/FirstMessage'msgdir 0)
  2009. temp=''
  2010. IF marknum='' THEN
  2011.   DO
  2012.     IF lastread.msgdir>=lstwrt | lastread.msgdir<frstwrt THEN
  2013.       DO
  2014.         lastread.msgdir=lstwrt
  2015.         CALL msgcount(msgdir)
  2016.         IF quietflag=1 & lastread.msgdir=lstwrt THEN RETURN
  2017.         IF nonstop=1 THEN temp=''
  2018.         ELSE temp=getinput(1 0 pen3'Enter starting message number > 'def)
  2019.         IF temp='' THEN temp=lastread.msgdir
  2020.         IF ~DATATYPE(temp,'W') THEN RETURN
  2021.         IF temp<frstwrt THEN temp=frstwrt
  2022.         IF temp>lstwrt THEN temp=lstwrt
  2023.         IF temp<1 THEN temp=1
  2024.         lastread.msgdir=temp-1
  2025.       END
  2026.   END
  2027. ELSE lastread.msgdir=marknum-1
  2028. IF quietflag=1 THEN SAY entering||CR
  2029. dirname=msgpath||msgdir
  2030. msglist.=0 /* set read to 0, unread to 1, and reply >=2 */
  2031. firstmess=999999
  2032. testlist=SHOWDIR(dirname)
  2033. DO i=1 TO WORDS(testlist)
  2034.   test=WORD(testlist,i)
  2035.   IF test>lastread.msgdir THEN msglist.test=1
  2036.   IF test<firstmess THEN firstmess=test
  2037. END
  2038. IF firstmess=999999 THEN firstmess=0
  2039. CALL countcheck(bbspath'Numbers/FirstMessage'msgdir firstmess)
  2040. msgstatus=1
  2041. IF temp='' & marknum='' THEN CALL msgcount(msgdir)
  2042. skipsubj.=''
  2043. skipsubj.0=0
  2044. DO msgloop=1
  2045.   lastreadnum=lastread.msgdir
  2046.   DO WHILE msglist.lastreadnum=0 & lastreadnum<lstwrt
  2047.     lastreadnum=lastreadnum+1
  2048.   END
  2049.   lastread.msgdir=lastreadnum
  2050.   IF lastreadnum=lstwrt & msglist.lstwrt=0 THEN LEAVE msgloop
  2051.   DO mess=lastread.msgdir TO lstwrt+1
  2052.     IF marknum~='' THEN
  2053.       DO
  2054.         IF mess>marknum THEN LEAVE msgloop
  2055.         mess=marknum
  2056.       END
  2057.     IF msglist.mess~=msgstatus THEN ITERATE mess
  2058.     IF msgstatus>1 THEN SAY 'Following the thread, level' msgstatus-1'.'CR
  2059.     msglist.mess=0
  2060.     arg=dirname'/'mess
  2061.     IF ~EXISTS(arg) THEN
  2062.       DO
  2063.         SAY 'Message number' mess 'is missing.'CR
  2064.         ITERATE mess
  2065.       END
  2066.     IF ~readopen(arg) THEN ITERATE mess
  2067.     firstline=READLN(f)
  2068.     secondline=READLN(f)
  2069.     thirdline=READLN(f)
  2070.     forthline=READLN(f)
  2071.     CALL CLOSE(f)
  2072.     CALL killmark(msgdir mess)
  2073.     DO skp=1 TO skipsubj.0
  2074.       IF forthline=skipsubj.skp THEN ITERATE mess
  2075.     END
  2076.     IF WORDS(firstline)>2 THEN /* if replies, change their num to >1 */
  2077.       DO
  2078.         thread=SUBSTR(firstline,WORDINDEX(firstline,4))
  2079.         DO tindx=1 TO WORDS(thread)
  2080.           test=WORD(thread,tindx)
  2081.           IF msglist.test~=0 THEN msglist.test=msgstatus+1
  2082.         END
  2083.       END
  2084.     savearg=arg
  2085.     msgcom='A'
  2086.     DO msgloop2=1 WHILE msgcom='A' | msgcom='O'
  2087.       CALL readlines(arg 1)
  2088.       IF nonstop=1 THEN rnonstop=1
  2089.       ELSE rnonstop=0
  2090.       CALL seelines(2)
  2091.       msgcom=''
  2092.       IF rnonstop THEN
  2093.         DO
  2094.           SAY CR
  2095.           nonstop=1
  2096.           msgcom=''
  2097.         END
  2098.       ELSE
  2099.         DO
  2100.           pline=''
  2101.           IF level<=sysoplevel | WORDS(lynes.3)<3 THEN pline='['pen3'A'def']gain'
  2102.           IF level>sysoplevel | name=WORD(lynes.2,2) THEN
  2103.             pline=pline '['pen3'E'def']dit ['pen3'K'def']ill'
  2104.           IF level>sysoplevel THEN pline=pline '['pen3'M'def']ove'
  2105.           IF WORDS(lynes.3)>3 THEN pline=pline '['pen3'O'def']riginal'
  2106.           pline=pline '['pen3'N'def']onStop ['pen3'R'def']eply'
  2107.           IF level=99 THEN pline=pline '['pen3'!'def']'
  2108.           pline=pline '['pen3'S'def']kip ['pen3'Q'def']uit ['pen3'?'def']'
  2109.           msgcom=getinput(1 0 STRIP(pline)' > ')
  2110.           CALL cleanline(0)
  2111.         END
  2112.       CALL checktime()
  2113.       IF DATATYPE(msgcom,'W') & EXISTS(dirname'/'msgcom) THEN
  2114.         DO
  2115.           arg=dirname'/'msgcom
  2116.           IF msgcom>lastread.msgdir THEN lastread.msgdir=msgcom
  2117.           msgcom='A'
  2118.           ITERATE msgloop2
  2119.         END
  2120.       ELSE msgcom=LEFT(msgcom,1)
  2121.       IF msgcom='Q' THEN LEAVE msgloop
  2122.       ELSE IF msgcom='!' & level>sysoplevel THEN
  2123.         DO
  2124.           CALL DELETE(arg)
  2125.           newchar=LEFT(lynes.1,1)
  2126.           IF newchar~='!' THEN newchar='!!'
  2127.           ELSE newchar='  '
  2128.           lynes.1=OVERLAY(newchar,lynes.1,1,2)
  2129.           CALL savelines(arg)
  2130.           ITERATE msgloop2
  2131.         END
  2132.       ELSE IF msgcom='A' THEN ITERATE msgloop2
  2133.       ELSE IF msgcom='M' & level>sysoplevel THEN
  2134.         DO
  2135.           prevmsgdir=msgdir
  2136.           If areaselect()=0 THEN
  2137.             DO
  2138.               himsg=countcheck(bbspath'Numbers/LastMessage'msgdir 0)+1
  2139.               lynes.1='  Msg:' himsg
  2140.               lynes.3='   To:' WORD(lynes.3,2)
  2141.               lynes.5=STRIP(DELWORD(lynes.5,8,1)) msg.msgdir
  2142.               nlyn=lynes.0+1
  2143.               lynes.0=nlyn
  2144.               lynes.nlyn=' *** Moved from the' msg.prevmsgdir 'conference ***'
  2145.               CALL savelines(msgpath||msgdir'/'himsg)
  2146.               CALL countcheck(bbspath'Numbers/LastMessage'msgdir himsg)
  2147.               CALL msgmark(WORD(lynes.3,2) msgdir himsg)
  2148.               CALL readlines(arg 1)
  2149.               CALL DELETE(arg)
  2150.               CALL DELAY(28)
  2151.               lynes.0=7
  2152.               lynes.7='*** Moved to the' msg.msgdir 'conference, message #'himsg' ***'
  2153.               CALL savelines(arg)
  2154.             END
  2155.           msgdir=prevmsgdir
  2156.           msgcom='A'
  2157.         END
  2158.       ELSE IF msgcom='N' THEN
  2159.         DO
  2160.           nonstop=1
  2161.           msgcom=''
  2162.         END
  2163.       ELSE IF msgcom='H' | msgcom='?' THEN
  2164.         DO
  2165.           SAY pen3' - HELP with the Read Messages commands -'def||CR
  2166.           SAY ' RETURN reads the next message in line.'CR
  2167.           SAY ' 34 will read message number 34, if it exists in this conference.'CR
  2168.           SAY ' A  reads this message Again (in case it scrolled off screen).'CR
  2169.           IF level>sysoplevel | name=WORD(lynes.2,2) THEN
  2170.             DO
  2171.           SAY ' E  puts this message into the online Editor.'CR
  2172.           SAY ' K  deletes a message you wrote. you cannot Kill others!'CR
  2173.             END
  2174.           IF level>sysoplevel THEN
  2175.           SAY ' M  move this message to a new conference.'CR
  2176.           SAY ' N  displays all new messages without pausing. CTRL-E to Exit!'CR
  2177.           SAY ' O  if this message is a reply, will read the Original message.'CR
  2178.           SAY ' R  enters the message editor to Reply to this message.'CR
  2179.           SAY ' S  allows you to Skip threads or conferences.'CR
  2180.         IF level=99 THEN
  2181.           SAY ' !  toggles the do-not-purge! flag for this message.'CR
  2182.           SAY ' Q  returns to the message menu. (Quit)'CR
  2183.           SAY CR
  2184.           CALL waiting()
  2185.           msgcom='A'
  2186.           IF waitchar='Q' THEN LEAVE msgloop
  2187.         END
  2188.       ELSE IF msgcom='E' THEN
  2189.         DO
  2190.           IF level>sysoplevel | name=WORD(lynes.2,2) THEN
  2191.             DO
  2192.               sline=7
  2193.               IF level>sysoplevel THEN sline=1
  2194.               CALL bbsED(sline arg)
  2195.               msgcom='A'
  2196.             END
  2197.         END
  2198.       ELSE IF msgcom='S' & mess<lstwrt THEN
  2199.         DO
  2200.           stemp=''
  2201.           DO WHILE stemp~='T' & stemp~='C'
  2202.             stemp=getinput(1 1 'Skip this ['pen3'T'def']hread or the entire ['pen3'C'def']onference (ct) > ')
  2203.           END
  2204.           IF stemp='T' THEN
  2205.             DO
  2206.               SAY CR
  2207.               SAY pen3 forthline||def||CR
  2208.               SAY 'Skipping messages with this subject heading...'CR
  2209.               SAY CR
  2210.               DO i=lastread.msgdir TO lstwrt
  2211.                 IF msglist.i>1 THEN msglist.i=0
  2212.               END
  2213.               skipsubj.0=skipsubj.0+1
  2214.               sksb=skipsubj.0
  2215.               skipsubj.sksb=forthline
  2216.             END
  2217.           ELSE
  2218.             DO
  2219.               SAY pen3'Skipping to the last message in the'def msg.msgdir pen3'conference.'def||CR
  2220.               lastread.msgdir=lstwrt-1
  2221.               lw=lstwrt-1
  2222.               msglist.lw=0
  2223.               msglist.lstwrt=1
  2224.               LEAVE mess
  2225.             END
  2226.         END
  2227.       ELSE IF msgcom='K' THEN
  2228.         DO
  2229.           IF level>sysoplevel | name=WORD(lynes.2,2) THEN
  2230.             DO
  2231.               IF getinput(1 1 'Really delete' arg'? (Ny) > ')='Y' THEN
  2232.                 DO
  2233.                   IF DELETE(arg)=1 THEN
  2234.                     SAY pen3||arg||def' has been deleted.'CR
  2235.                   grand=grand-1
  2236.                   msg.msgdir.0=msg.msgdir.0-1
  2237.                 END
  2238.             END
  2239.         END
  2240.       ELSE IF msgcom='O' THEN   /* go back and read original */
  2241.         DO
  2242.           IF WORDS(lynes.3)>3 THEN
  2243.             DO
  2244.               temp=WORD(lynes.3,4)
  2245.               arg=dirname'/'temp
  2246.             END
  2247.           ELSE SAY 'This is the original message.'CR
  2248.         END
  2249.       ELSE IF msgcom='R' THEN        /*  toname     msgnum  */
  2250.         DO
  2251.           msgnum=WORD(lynes.1,2)
  2252.           forthline=lynes.4
  2253.           IF editor('REPLY' WORD(lynes.2,2) msgnum) THEN /* reply */
  2254.             DO
  2255.               savearg2=arg
  2256.               arg=dirname'/'WORD(lynes.3,4)
  2257.               IF EXISTS(arg) THEN
  2258.                 DO
  2259.                   IF readlines(arg 1) THEN BREAK
  2260.                   xmsg=countcheck(bbspath'Numbers/LastMessage'msgdir mess)
  2261.                   IF WORDS(lynes.1)>3 THEN lynes.1=lynes.1 xmsg
  2262.                   ELSE lynes.1=lynes.1'   Reply' xmsg
  2263.                   CALL DELAY(28)    /* allow 1/2 sec for read to close */
  2264.                   CALL savelines(arg)
  2265.                 END
  2266.               arg=savearg2
  2267.             END
  2268.         END
  2269.       ELSE IF arg~=savearg THEN    /* Continue */
  2270.         DO
  2271.           msgcom='A'
  2272.           arg=savearg
  2273.         END
  2274.     END
  2275.     IF thread~='' THEN
  2276.       DO
  2277.         thread=''
  2278.         msgstatus=msgstatus+1
  2279.       END
  2280.   END
  2281.   IF msgstatus>1 THEN msgstatus=msgstatus-1
  2282. END
  2283. DROP msglist. skipsubj.
  2284. IF quietflag~=1 THEN nonstop=0
  2285. RETURN
  2286.  
  2287.  
  2288. showmarked:
  2289. IF WORDS(data.24)<1 THEN RETURN
  2290. SAY CR
  2291. SAY pen6'These unread conference messages have been ['pen3'M'pen6']arked as addressed to you:'def||CR
  2292. tempkk=data.24
  2293. DO i=1 TO WORDS(tempkk)
  2294.   tempk=WORD(tempkk,i)
  2295.   PARSE VAR tempk kdir'/'kmsg
  2296.   IF EXISTS(msgpath||kdir'/'kmsg) THEN
  2297.     SAY RIGHT(kmsg,6) 'in the'pen3 msg.kdir def'conference.'CR
  2298.   ELSE data.24=DELWORD(data24,FIND(data.24,tempk))
  2299. END
  2300. CALL waiting()
  2301. SAY CR
  2302. RETURN
  2303.  
  2304.  
  2305. killmark:
  2306. PARSE ARG kdir kmsg .
  2307. IF data.24='' THEN RETURN
  2308. markword=FIND(data.24,kdir'/'kmsg)
  2309. IF markword>0 THEN data.24=STRIP(DELWORD(data.24,markword,1))
  2310. RETURN
  2311.  
  2312.  
  2313. readmarked:
  2314. mrknum=WORDS(data.24)
  2315. IF mrknum=0 THEN RETURN
  2316. SAY 'Reading only messages addressed to you...'CR
  2317. mrklist=data.24
  2318. msgcom=''
  2319. DO rmki=1 TO mrknum WHILE msgcom~='Q'
  2320.   tempk=WORD(mrklist,rmki)
  2321.   PARSE VAR tempk mkdir'/'mkmsg .
  2322.   IF ~EXISTS(msgpath||tempk) THEN
  2323.     DO
  2324.       CALL killmark(mkdir mkmsg)
  2325.       SAY CR
  2326.       SAY 'Message number' mkmsg 'in the' msg.mkdir 'conference is missing!'CR
  2327.       SAY CR
  2328.       ITERATE rmki
  2329.     END
  2330.   msgdir=mkdir
  2331.   savelast=lastread.msgdir
  2332.   CALL readmsg(1 mkmsg)
  2333.   IF mkmsg>savelast THEN lastread.msgdir=mkmsg
  2334.   ELSE lastread.msgdir=savelast
  2335. END
  2336. CALL saveData(1)
  2337. RETURN
  2338.  
  2339.  
  2340. sortnumbers:
  2341. PARSE ARG slist
  2342. IF STRIP(slist)='' THEN RETURN ''
  2343. sorted.=''
  2344. oldest=999999
  2345. newest=0
  2346. newlist=''
  2347. DO si=1 TO WORDS(slist)
  2348.   testword=WORD(slist,si)
  2349.   IF ~DATATYPE(testword,'W') THEN
  2350.     DO
  2351.       testpos=LASTPOS('.',testword)
  2352.       IF testpos>0 THEN tempnum=SUBSTR(testword,testpos+1)
  2353.       ELSE
  2354.         DO
  2355.           newlist=testword newlist
  2356.           ITERATE si
  2357.         END
  2358.     END
  2359.   ELSE tempnum=testword/1
  2360.   IF sorted.tempnum='' THEN
  2361.     DO
  2362.       sorted.tempnum=testword
  2363.       sorted.tempnum.0=1
  2364.       IF DATATYPE(tempnum,'W') THEN
  2365.         DO
  2366.           IF tempnum>newest THEN newest=tempnum
  2367.           IF tempnum<oldest THEN oldest=tempnum
  2368.         END
  2369.     END
  2370.   ELSE newlist=newlist testword
  2371. END
  2372. IF oldest~=999999 & newest~=0 THEN
  2373.   DO si=oldest TO newest
  2374.     IF sorted.si.0=1 THEN newlist=newlist sorted.si
  2375.   END
  2376. DROP sorted. oldest newest
  2377. RETURN STRIP(newlist)
  2378.  
  2379.  
  2380. readmail:
  2381. ARG fromenu .
  2382. CALL postuser(3)
  2383. replysubj=''
  2384. IF fromenu THEN
  2385.   DO
  2386.     temp=UPPER(arg)
  2387.     arg=''
  2388.     IF temp~='F' & temp~='T' & temp~='W' THEN
  2389.       DO
  2390.         line='Find Email ['pen3'F'def']rom You ['pen3'T'def']o You or ['pen3'W'def']rite New Email (ftw) > 'def
  2391.         temp=getinput(1 1 line)
  2392.         CALL cleanline(0)
  2393.       END
  2394.     IF temp='W' THEN
  2395.       DO
  2396.         CALL editor('MAIL')
  2397.         RETURN
  2398.       END
  2399.     ELSE IF temp='F' THEN
  2400.       DO
  2401.         firsteditline=0
  2402.         picklist.=''
  2403.         picklist.0=0
  2404.         IF getinput(1 1 'Check ALL users? (nY) > ')='N' THEN
  2405.           DO
  2406.             picklist.1=getinput(1 0 'Check EMail From' name 'To Who? > ')
  2407.             picklist.1=SPACE(STRIP(UPPER(picklist.1)),1,'_')
  2408.             picklist.1=COMPRESS(picklist.1,'.,:/*#?^ ')
  2409.             IF picklist.1='' THEN RETURN
  2410.             IF FIND(userlist,picklist.1)=0 THEN
  2411.               DO
  2412.                 SAY '***'pen3 picklist.1 def'does not exist!'||CR
  2413.                 picklist.0=0
  2414.                 RETURN
  2415.               END
  2416.             fmaillist=SHOWDIR(bbspath'EMail/'picklist.1)
  2417.             DO ej=1 TO WORDS(fmaillist)
  2418.               ejname=WORD(fmaillist,ej)
  2419.               uname=ejname
  2420.               caret=LASTPOS('.',uname)
  2421.               IF caret>2 THEN uname=LEFT(uname,caret-1)
  2422.               IF uname=name THEN
  2423.                 DO
  2424.                   arg=bbspath'EMail/'picklist.1'/'ejname
  2425.                   IF EXISTS(arg) THEN
  2426.                     DO
  2427.                       pklst=picklist.0+1
  2428.                       picklist.pklst=picklist.1
  2429.                       picklist.pklst.0=ejname
  2430.                       picklist.0=pklst
  2431.                     END
  2432.                 END
  2433.             END
  2434.             IF picklist.0=0 THEN SAY 'No Email FROM you was found.'||CR
  2435.             ELSE
  2436.               DO
  2437.                 SAY pen3'You have the following Email pending:'def||CR
  2438.                 pickcheck=1
  2439.                 DO WHILE pickcheck~=0
  2440.                   pickcheck=pickfromlist()
  2441.                   IF pickcheck~=0 THEN
  2442.                     DO
  2443.                       firsteditline=5
  2444.                       IF level>sysoplevel THEN firsteditline=1
  2445.                       CALL bbsED(firsteditline bbspath'Email/'picklist.pickcheck'/'picklist.pickcheck.0)
  2446.                       IF ~EXISTS(bbspath'Email/'picklist.pickcheck'/'picklist.pickcheck.0) THEN
  2447.                         picklist.pickcheck='- KILLED -'
  2448.                     END
  2449.                 END
  2450.               END
  2451.           END
  2452.         ELSE
  2453.           DO
  2454.             SAY pen3'Scanning'def WORDS(userlist) pen3'email directories...'def||CR
  2455.             DO ei=1 TO WORDS(userlist)
  2456.               fmaillist=SHOWDIR(bbspath'EMail/'WORD(userlist,ei))
  2457.               DO ej=1 TO WORDS(fmaillist)
  2458.                 ejname=WORD(fmaillist,ej)
  2459.                 uname=ejname
  2460.                 caret=LASTPOS('.',uname)
  2461.                 IF caret>2 THEN uname=LEFT(uname,caret-1)
  2462.                 IF uname=name THEN
  2463.                   DO
  2464.                     arg=bbspath'EMail/'WORD(userlist,ei)'/'ejname
  2465.                     IF EXISTS(arg) THEN
  2466.                       DO
  2467.                         pklst=picklist.0+1
  2468.                         picklist.pklst=WORD(userlist,ei)
  2469.                         picklist.pklst.0=ejname
  2470.                         picklist.0=pklst
  2471.                       END
  2472.                   END
  2473.               END
  2474.             END
  2475.             IF picklist.0=0 THEN SAY lineup'No Email FROM you was found.                  'CR
  2476.             ELSE
  2477.               DO
  2478.                 SAY pen3'You have Email pending to the following users:'def||CR
  2479.                 pickcheck=1
  2480.                 DO WHILE pickcheck~=0
  2481.                   pickcheck=pickfromlist()
  2482.                   IF pickcheck~=0 THEN
  2483.                     DO
  2484.                       firsteditline=5
  2485.                       IF level>sysoplevel THEN firsteditline=1
  2486.                       CALL bbsED(firsteditline bbspath'Email/'picklist.pickcheck'/'picklist.pickcheck.0)
  2487.                       IF ~EXISTS(bbspath'Email/'picklist.pickcheck'/'picklist.pickcheck.0) THEN
  2488.                         picklist.pickcheck='- KILLED -'
  2489.                     END
  2490.                 END
  2491.               END
  2492.           END
  2493.         DROP picklist.
  2494.         RETURN
  2495.       END
  2496.     ELSE IF temp='T' THEN BREAK
  2497.     ELSE RETURN
  2498.   END
  2499. SAY 'Checking your mailbox..'CR
  2500. nomail=1
  2501. CALL MAKEDIR(bbspath'EMail/'name)
  2502. mailist=sortnumbers(SHOWDIR(bbspath'Email/'name))
  2503. IF WORDS(mailist)=0 THEN RETURN
  2504. line=WORDS(mailist)
  2505. IF line>1 THEN line=line 'letters'
  2506. ELSE line=line 'letter'
  2507. line=line 'waiting.'
  2508. SAY line||CR
  2509. DO ii=1 TO WORDS(mailist)
  2510.   SAY 'Email:' pen3||WORD(mailist,ii)||def||CR
  2511. END
  2512. IF ~fromenu THEN
  2513.   IF getinput(1 1 'Read your private mail now? (nY) > ')='N' THEN RETURN
  2514. onename=''
  2515. IF WORDS(mailist)>3 THEN
  2516.   DO
  2517.     IF getinput(1 1 'Read all private mail? (nY) > ')='N' THEN
  2518.       DO
  2519.         onename=getinput(1 0 'Read ONLY private mail from? > ')
  2520.         onename=SPACE(STRIP(UPPER(onename)),1,'_')
  2521.         onename=COMPRESS(onename,'.,:/*#?^ ')
  2522.         IF onename='' THEN RETURN
  2523.         IF FIND(userlist,onename)=0 & picklist.1~='BBBBS' THEN
  2524.           DO
  2525.             SAY '***'pen3 onename def'does not exist!'||CR
  2526.             RETURN
  2527.           END
  2528.       END
  2529.   END
  2530. DO letter=1 TO WORDS(mailist)
  2531.   readname=WORD(mailist,letter)
  2532.   uname=readname
  2533.   caret=LASTPOS('.',uname)
  2534.   IF caret>2 THEN uname=LEFT(uname,caret-1)
  2535.   IF onename~='' & onename~=uname THEN ITERATE letter
  2536.   arg=bbspath'Email/'name'/'readname        /* user has mail! */
  2537.   CALL readlines(arg 1)
  2538.   CALL seelines(1)
  2539.   nomail=0
  2540.   nonstop=0
  2541.   mailfile=''
  2542.   IF UPPER(WORD(lynes.1,3))='FILE:' THEN mailfile=WORD(lynes.1,4)
  2543.   ELSE IF UPPER(WORD(lynes.2,3))='FILE:' THEN mailfile=WORD(lynes.2,4)
  2544.   IF mailfile~='' & readname~='NEW_FILES' & readname~='FILELISTS_REPORT' & readname~='INACTIVE_USERS' & LEFT(readname,3)~='MSG' THEN
  2545.     DO
  2546.       IF LEFT(RIGHT(mailfile,4),1)~='.' & LEFT(readname,6)='BBBBS.' THEN
  2547.         DO
  2548.           SAY CR
  2549.           SAY pen3'The attached file is unarchived and may be incomplete.'CR
  2550.           SAY 'If the archiver is still building this file, downloading will fail.'def||CR
  2551.           IF getinput(1 1 'Do you want to try to download it anyway? (Ny) > ')~='Y' THEN ITERATE letter
  2552.           SAY CR
  2553.         END
  2554.       curdir=PRAGMA('D')
  2555.       CALL setdir(bbspath'EmailFiles/'name)
  2556.       filesize=WORD(STATEF(mailfile),2)
  2557.       IF getinput(1 1 ' Attached file:' pen3||mailfile||def 'is' pen3||filesize||def 'bytes.  Download now? (nY) > ')~='N' THEN
  2558.         DO
  2559.           savearg=arg
  2560.           arg=mailfile
  2561.           DO WHILE dload()=1
  2562.           END
  2563.           arg=savearg
  2564.         END
  2565.       CALL setdir(curdir)
  2566.     END
  2567.   IF readname~='NEW_FILES' & readname~='FILELISTS_REPORT' & readname~='INACTIVE_USERS' & LEFT(readname,3)~='MSG' & LEFT(readname,6)~='BBBBS.' THEN
  2568.     DO
  2569.       tempchar='A'
  2570.       DO WHILE tempchar='A'
  2571.         tempchar=getinput(1 1 '['pen3'A'def']gain  ['pen3'C'def']ontinue  ['pen3'R'def']eply (acR) > ')
  2572.         IF tempchar='' THEN tempchar='R'
  2573.         IF tempchar='A' THEN CALL seelines(1)
  2574.       END
  2575.       IF tempchar='R' THEN
  2576.         DO
  2577.           IF WORDS(lynes.4)<2 THEN replysubj='NONE'
  2578.           ELSE replysubj=SUBSTR(lynes.4,WORDINDEX(lynes.4,2))
  2579.           CALL editor('MAIL' uname)
  2580.           replysubj=''
  2581.         END
  2582.     END
  2583.   IF LEFT(readname,6)~='BBBBS.' THEN
  2584.     DO
  2585.       tempchar='A'
  2586.       DO WHILE tempchar='A'
  2587.         tempchar=getinput(1 1 'Forward mail from'pen3 uname def'to other users? (aNy) > ')
  2588.         IF tempchar='A' THEN CALL seelines(1)
  2589.       END
  2590.       IF tempchar='Y' THEN
  2591.         DO
  2592.           IF selectchosen(1 pen3'Forward Email To: 'def)=0 THEN
  2593.             DO ei=1 TO thechosen.0 WHILE thechosen.ei~=''
  2594.               CALL MAKEDIR(bbspath'EMail/'thechosen.ei)
  2595.               forwardarg=bbspath'Email/'thechosen.ei'/'readname
  2596.               ADDRESS COMMAND 'C:COPY' bbspath'Email/'name'/'readname forwardarg
  2597.               CALL readlines(forwardarg 1)
  2598.               lynes.1=lynes.1'  Forwarded to you by' name TIME('C') DATE()
  2599.               CALL DELETE(forwardarg)
  2600.               CALL savelines(forwardarg)
  2601.               IF WORDS(lynes.2)>3 THEN
  2602.                 DO
  2603.                   forname=bbspath'EmailFiles/'name'/'WORD(lynes.2,4)
  2604.                   IF EXISTS(forname) THEN
  2605.                     DO
  2606.                       CALL MAKEDIR(bbspath'EmailFiles/'thechosen.ei)
  2607.                       ADDRESS COMMAND 'C:COPY' forname bbspath'EmailFiles/'thechosen.ei
  2608.                     END
  2609.                 END
  2610.               line='Mail' pen3||readname||def 'forwarded to' pen3||thechosen.ei||def
  2611.               IF emailonline>=0 THEN emailonline=emailonline+1
  2612.               CALL send2log(line)
  2613.               SAY line||CR
  2614.             END
  2615.         END
  2616.     END
  2617.   tempchar=getinput(1 1 'Delete the mail from'pen3 uname def'you just read? (nqY) > 'def)
  2618.   IF tempchar='Q' THEN
  2619.     DO
  2620.       IF getinput(1 1 'Quit reading your Email? (Ny) > ')='Y' THEN
  2621.         DO
  2622.           readname=''
  2623.           uname=''
  2624.           RETURN
  2625.         END
  2626.     END
  2627.   ELSE IF tempchar~='N' THEN
  2628.     DO
  2629.       dirname=bbspath'Email/'name'/'
  2630.       nodelete=0
  2631.       IF bbsprefs.14=1 & name~=sysop & uname~=sysop & WORD(lynes.2,2)~='BBBBS' & WORD(lynes.2,2)~=sysop & WORD(lynes.3,2)~=sysop THEN
  2632.         nodelete=1
  2633.       IF nodelete THEN
  2634.         ADDRESS COMMAND 'C:Copy' dirname||readname bbspath'Email/'sysop
  2635.       ELSE emailonline=emailonline-1
  2636.       CALL DELETE(dirname||readname)
  2637.       tempstr='Old email'
  2638.       IF mailfile~='' & readname~='NEW_FILES' & readname~='FILELISTS_REPORT' & readname~='INACTIVE_USERS' & EXISTS(bbspath'EmailFiles/'name'/'mailfile) THEN
  2639.         DO
  2640.           IF nodelete THEN
  2641.             ADDRESS COMMAND 'C:Copy' bbspath'EmailFiles/'name'/'mailfile bbspath'EmailFiles/'sysop
  2642.           CALL DELETE(bbspath'EmailFiles/'name'/'mailfile)
  2643.           CALL DELETE(bbspath'EmailFiles/'name'/'mailfile'.xdl')
  2644.           tempstr=tempstr 'and attached file'
  2645.         END
  2646.       tempstr=tempstr 'deleted. Thank you for keeping a clean BBS!'
  2647.       SAY tempstr||CR
  2648.       IF tempchar='Q' THEN
  2649.         IF getinput(1 1 'Quit reading your Email? (Ny) > ')='Y' THEN
  2650.           DO
  2651.             readname=''
  2652.             uname=''
  2653.             RETURN
  2654.           END
  2655.     END
  2656.   ELSE IF LEFT(readname,3)='MSG' & level>sysoplevel THEN
  2657.     DO
  2658.       ii=LEFT(readname,POS('.',readname)-1)
  2659.       ii=SUBSTR(ii,4)%1
  2660.       IF getinput(1 1 'Move this message back to the' msg.ii 'conference? (nY) > 'def)~='N' THEN
  2661.         DO
  2662.           temp=TRANSLATE(readname,'/','.')
  2663.           temp=SUBSTR(temp,4)
  2664.           lynes.1='!!'STRIP(lynes.1)
  2665.           edtype=''
  2666.           CALL savelines(msgpath||temp)
  2667.           CALL DELETE(bbspath'Email/'name'/'readname)
  2668.         END
  2669.     END
  2670.   ELSE IF LEFT(readname,3)~='MSG' & readname~='NEW_FILES' & readname~='FILELISTS_REPORT' & readname~='INACTIVE_USERS' THEN
  2671.     DO
  2672.       arg=bbspath'Email/'name'/'readname
  2673.       CALL readlines(arg 1)
  2674.       IF WORDS(lynes.5)<7 THEN
  2675.         DO
  2676.           lynes.5=lynes.5'  (Rcvd)' DATE('W') DATE() TIME('C')
  2677.           CALL DELETE(arg)
  2678.           CALL savelines(arg)
  2679.           SAY 'Email has been marked as received.'CR
  2680.         END
  2681.     END
  2682.   CALL checktime()
  2683.   readname=''
  2684.   uname=''
  2685.   arg=''
  2686. END
  2687. IF nomail THEN
  2688.   DO
  2689.     SAY 'No mail was found.'CR
  2690.     CALL waiting()
  2691.   END
  2692. CALL setdir(libpath||dirs.1)
  2693. thechosen.=''
  2694. RETURN
  2695.  
  2696.  
  2697. selectchosen:
  2698. PARSE ARG startat selectline
  2699. IF startat<2 THEN thechosen.=''
  2700. line='Enter list of comma separated user names'
  2701. IF level>sysoplevel THEN line=line 'or ALL'
  2702. SAY line||CR
  2703. thechosen.startat=getinput(1 0 selectline' ')
  2704. IF STRIP(thechosen.startat)='' THEN RETURN 1
  2705. thechosen.startat=SPACE(thechosen.startat,1,'_')
  2706. thechosen.0=startat
  2707. IF level>sysoplevel & thechosen.startat='ALL' THEN
  2708.   thechosen.startat=SHOWDIR(bbspath'Users','F',',')
  2709. IF POS(',',thechosen.startat)>0 THEN
  2710.   DO
  2711.     temp=TRANSLATE(thechosen.startat,' ',',')
  2712.     thechosen.0=thechosen.0+WORDS(temp)-1
  2713.     DO ei=1 TO WORDS(temp)
  2714.       eii=startat+ei-1
  2715.       thechosen.eii=STRIP(WORD(temp,ei))
  2716.     END
  2717.   END
  2718. DO ei=startat TO thechosen.0
  2719.   DO WHILE FIND(userlist,thechosen.ei)=0
  2720.     IF thechosen.ei~='' THEN
  2721.       DO
  2722.         IF FIND(exclusion,thechosen.ei)>0 | thechosen.ei='BBBBS' THEN
  2723.           DO
  2724.             thechosen.ei=sysop
  2725.             ITERATE ei
  2726.           END
  2727.         CALL loadcourtesy()
  2728.         IF FIND(courtesy,thechosen.ei)>0 THEN ITERATE ei
  2729.       END
  2730.     SAY thechosen.ei 'not found! Enter that name again or press RETURN.'CR
  2731.     thechosen.ei=getinput(1 0 pen3||selectline' 'def)
  2732.     IF thechosen.ei='' THEN
  2733.       DO
  2734.         IF getinput(1 1 'Do you want to see the list of current users? (Ny) > ')='Y' THEN
  2735.           CALL showuserlist()
  2736.         ITERATE ei
  2737.       END
  2738.     thechosen.ei=SPACE(thechosen.ei,1,'_')
  2739.   END
  2740. END
  2741. RETURN 0
  2742.  
  2743.  
  2744. countcheck:
  2745. PARSE ARG fname' 'cknum' '.
  2746. IF ~EXISTS(fname) THEN
  2747.   DO
  2748.     IF cknum=0 THEN RETURN 0
  2749.     IF ~writeopen(fname) THEN RETURN 0
  2750.     CALL WRITELN(f,cknum)
  2751.     CALL CLOSE(f)
  2752.     RETURN cknum
  2753.   END
  2754. IF ~readopen(fname) THEN RETURN cknum
  2755. retval=STRIP(READLN(f))
  2756. CALL CLOSE(f)
  2757. IF ~DATATYPE(retval,'W') THEN retval=0
  2758. IF ~DATATYPE(cknum,'W') THEN cknum=0
  2759. IF retval<cknum THEN
  2760.   DO
  2761.     IF writeopen(fname) THEN
  2762.       DO
  2763.         CALL WRITELN(f,cknum)
  2764.         CALL CLOSE(f)
  2765.         RETURN cknum
  2766.       END
  2767.   END
  2768. RETURN retval
  2769.  
  2770.  
  2771. pickfromlist:
  2772. DO pfl=1 TO picklist.0 BY 3
  2773.   pfl2=pfl+1
  2774.   pfl3=pfl+2
  2775.   pfline=pen3||RIGHT(pfl,3)||def LEFT(picklist.pfl,21)
  2776.   IF picklist.pfl2~='' THEN
  2777.     pfline=pfline pen3||RIGHT(pfl2,3)||def LEFT(picklist.pfl2,21)
  2778.   IF picklist.pfl3~='' THEN
  2779.     pfline=pfline pen3||RIGHT(pfl3,3)||def LEFT(picklist.pfl3,21)
  2780.   SAY pfline||CR
  2781. END
  2782. emnum=getinput(1 0 pen3'Select Email Number > 'def)
  2783. IF ~DATATYPE(emnum,'W') | emnum<1 | emnum>picklist.0 THEN RETURN 0
  2784. RETURN emnum
  2785.  
  2786.  
  2787. sysED:
  2788. IF level<99 THEN RETURN
  2789. arg=getinput(0 0 'Textfile To Edit: ')
  2790. IF arg='' THEN RETURN
  2791. CALL bbsED(1 arg)
  2792. RETURN
  2793.  
  2794.  
  2795. bbsED:
  2796. PARSE ARG firstedit editarg .
  2797. notchanged=1
  2798. IF readlines(editarg 1) THEN RETURN 1
  2799. finfo=STATEF(editarg)
  2800. IF WORDS(finfo)>7 THEN finfo=SUBSTR(finfo,WORDINDEX(finfo,8))
  2801. ELSE finfo=''
  2802. SAY CR
  2803. SAY '                   'pen3'Entering the EDITOR module..'def||CR
  2804. SAY CR
  2805. count=1
  2806. DO edloop=1
  2807.   IF edcom='S' & bbsprefs.5 THEN  /* spell check */
  2808.     DO
  2809.       SAY pen3'You must use ['def'R'pen3']eplace to make corrections.  'pen2'Spellchecking...'def||CR
  2810.       CALL DELETE(scratch'/SpellFile')
  2811.       CALL savelines(scratch'/SpellFile')
  2812.       curdir=PRAGMA('D')
  2813.       CALL setdir(spellpath)
  2814.       CALL SpellChk.rexx(scratch'/SpellFile')
  2815.       CALL setdir(curdir)
  2816.     END
  2817.   ELSE
  2818.     DO
  2819.       IF edcom='R' | edcom='I' | edcom='L' THEN CALL wrapbuf(7)
  2820.       IF edcom~='L' THEN count=count-linesperpage
  2821.       IF count>=lynes.0 | count<1 THEN count=1
  2822.       startcount=count
  2823.       DO i=startcount TO lynes.0+1
  2824.         IF ((i+1-startcount)//linesperpage)=0 THEN
  2825.           DO
  2826.             pline='                 ['pen3'E'def']dit'
  2827.             pline=pline '  ['pen3'RETURN'def']=Continue '
  2828.             edcom=getinput(1 1 pline)
  2829.             IF edcom~='' THEN LEAVE i
  2830.             CALL cleanline(1)
  2831.           END
  2832.         SAY pen3||RIGHT(i,3)||def lynes.i||CR
  2833.         count=count+1
  2834.       END
  2835.     END
  2836.   CALL checktime()
  2837.   SAY lineup'     ['pen3'A'def']ppend ['pen3'C'def']ut     ['pen3'I'def']nsert  ['pen3'K'def']ill       ['pen3'?'def'] Help'CR
  2838.   pline='     ['pen3'L'def']ist   ['pen3'P'def']aste   ['pen3'R'def']eplace'
  2839.   IF bbsprefs.5 THEN pline=pline '['pen3'S'def']pellcheck'
  2840.   pline=pline '['pen3'U'def']pload-Text > '
  2841.   edcom=getinput(1 0 pline)
  2842.   IF edcom='Q' | edcom='X' THEN edcom=''
  2843.   IF edcom='?' THEN
  2844.     DO
  2845.       SAY CR
  2846.       SAY '                   Editor Help'CR
  2847.       SAY '-------------------------------------------------------'CR
  2848.       SAY ' 7  edits line number 7, if it exists.'CR
  2849.       SAY ' a  Append text to this file.'CR
  2850.       SAY ' c  Cut selected line(s) of text to buffer.'CR
  2851.       SAY ' i  Insert blank line.'CR
  2852.       SAY ' k  Kill (delete) this file.'CR
  2853.       SAY ' l  List this file from selected line.'CR
  2854.       SAY ' p  Paste buffer contents to selected line number.'CR
  2855.       SAY ' r  Replace a phrase or line of text.'CR
  2856.       SAY ' s  Spellcheck this file.'CR
  2857.       SAY ' u  Upload a textfile to append to this file.'CR
  2858.       SAY '    An empty RETURN indicates you are finished editing.'CR
  2859.       SAY '-------------------------------------------------------'CR
  2860.       SAY CR
  2861.       OPTIONS PROMPT ''
  2862.       PULL
  2863.     END
  2864.   IF edcom='K' THEN
  2865.     DO
  2866.       junk=getinput(1 1 'Are you' pen3'sure'def 'you want to delete' editarg'? (Ny) > ')
  2867.       IF junk='Y' THEN
  2868.         DO
  2869.           IF DELETE(editarg)=1 THEN SAY editarg 'DELETED.'CR
  2870.           IF WORD(lynes.1,1)='Mail:' & WORDS(lynes.2)>3 THEN
  2871.             DO
  2872.               IF DELETE(bbspath'EmailFiles/'WORD(lynes.3,2)'/'WORD(lynes.2,4))=1 THEN
  2873.                 SAY WORD(lynes.2,4) 'DELETED.'CR
  2874.             END
  2875.           RETURN 2
  2876.         END
  2877.     END
  2878.   IF edcom='' THEN
  2879.     DO
  2880.       SAY '                   'pen3'Leaving the EDITOR module.'def||CR
  2881.       IF notchanged THEN RETURN 0
  2882.       IF getinput(1 1 '                     Save changes? (nY)'pen3' > 'def)='N' THEN
  2883.         RETURN 1
  2884.       CALL DELETE(editarg)
  2885.       IF savelines(editarg) THEN RETURN 1
  2886.       CALL DELAY(28)
  2887.       IF finfo~='' THEN ADDRESS COMMAND 'C:filenote' editarg finfo
  2888.       SAY pen3'                        Changes saved.'def||CR
  2889.       RETURN 0
  2890.     END
  2891.   ELSE IF edcom='C' THEN  /* Cut */
  2892.     DO
  2893.       firstnum=getinput(1 0 '   Enter line number or range 'pen3'(5-7)'def' to cut' pen3'>'def)
  2894.       IF firstnum='' THEN ITERATE edloop
  2895.       dash=POS('-',firstnum)
  2896.       IF dash>0 THEN
  2897.         DO
  2898.           lastnum=STRIP(SUBSTR(firstnum,dash+1))
  2899.           firstnum=STRIP(LEFT(firstnum,dash-1))
  2900.         END
  2901.       ELSE lastnum=firstnum
  2902.       IF ~DATATYPE(firstnum,'W') | ~DATATYPE(lastnum,'W') THEN
  2903.         DO
  2904.           junk=getinput(1 1 pen3'*** You must enter numbers here! 'def)
  2905.           ITERATE edloop
  2906.         END
  2907.       IF lastnum>lynes.0 THEN lastnum=lynes.0
  2908.       IF firstnum<firstedit THEN
  2909.         DO
  2910.           SAY '*** You are not authorized to delete that line!'CR
  2911.           SAY CR
  2912.           ITERATE edloop
  2913.         END
  2914.       IF firstnum>lastnum THEN
  2915.         DO
  2916.           SAY '*** Input error!  First number larger than last number.'CR
  2917.           ITERATE edloop
  2918.         END
  2919.       notchanged=0
  2920.       numdiff=lastnum+1-firstnum
  2921.       pasted.=''
  2922.       pasted.0=numdiff
  2923.       k=0
  2924.       DO i=firstnum TO lynes.0
  2925.         j=i+numdiff
  2926.         k=k+1
  2927.         IF k<=numdiff THEN pasted.k=lynes.i
  2928.         lynes.i=lynes.j
  2929.         lynes.j=''
  2930.       END
  2931.       lynes.0=lynes.0-numdiff
  2932.       count=1
  2933.     END
  2934.   ELSE IF edcom='A' THEN  /* append */
  2935.     DO
  2936.       CALL writebuffer(scratch'/EditorFile')
  2937.       notchanged=0
  2938.     END
  2939.   ELSE IF edcom='U' THEN  /* Upload a textfile to append */
  2940.     DO
  2941.       CALL txup(1)
  2942.       notchanged=0
  2943.     END
  2944.   ELSE IF edcom='I' | edcom='R' | edcom='L' | edcom='P' | DATATYPE(edcom,'W') THEN
  2945.     DO
  2946.       IF DATATYPE(edcom,'W') THEN
  2947.         DO
  2948.           ednum=edcom
  2949.           edcom='R'
  2950.         END
  2951.       ELSE
  2952.         DO
  2953.           line=pen3'   '
  2954.           IF edcom='L' | edcom='P' THEN line=line'Starting '
  2955.           line=line'Line Number? > 'def
  2956.           ednum=getinput(1 0 line)
  2957.         END
  2958.       IF ~DATATYPE(ednum,'W') THEN ITERATE edloop
  2959.       IF ednum>(lynes.0+1) THEN ITERATE edloop
  2960.       IF edcom='L' THEN
  2961.         DO
  2962.           count=ednum
  2963.           ITERATE edloop
  2964.         END
  2965.       IF ednum=1 & UPPER(WORD(lynes.1,1))='FILE:' THEN
  2966.         DO
  2967.           IF getinput(1 1 pen3'Edit KeyWords:? (Ny) > 'def)='Y' THEN
  2968.             DO
  2969.               filenum=STRIP(WORD(lynes.1,2))
  2970.               num=files.filenum.0
  2971.               keywords=edkeywords(editarg)
  2972.               lynes.1=LEFT(lynes.1,21) keywords
  2973.               alpha.num=TRIM(OVERLAY(keywords,alpha.num,47,32))
  2974.               savefileflag=1
  2975.               notchanged=0
  2976.               ITERATE edloop
  2977.             END
  2978.         END
  2979.       IF ednum<firstedit THEN
  2980.         DO
  2981.           SAY '*** You are not authorized to alter that line!'CR
  2982.           SAY CR
  2983.           ITERATE edloop
  2984.         END
  2985.       IF edcom='R' THEN   /* replace */
  2986.         DO
  2987.           SAY '   Now reads:'CR
  2988.           SAY pen3||RIGHT(ednum,2)||def lynes.ednum||CR
  2989.           OPTIONS PROMPT pen3'........Search text? >'def
  2990.           PARSE PULL stext
  2991.           IF LENGTH(stext)=0 THEN
  2992.             DO
  2993.               IF getinput(1 1 lineup||pen3'Replace entire line? (nY) >'def)='N' THEN
  2994.                 ITERATE edloop
  2995.               lynes.ednum=getinput(0 0 pen3||RIGHT(ednum,2)' 'def)
  2996.               notchanged=0
  2997.               ITERATE edloop
  2998.             END
  2999.           found=POS(UPPER(stext),UPPER(lynes.ednum))
  3000.           IF found=0 THEN
  3001.             DO
  3002.               SAY CR
  3003.               SAY stext' was not found!'CR
  3004.               SAY CR
  3005.               ITERATE edloop
  3006.             END
  3007.           OPTIONS PROMPT pen3'...Replacement text? >'def
  3008.           PARSE PULL rtext
  3009.           lynes.ednum=DELSTR(lynes.ednum,found,LENGTH(stext))
  3010.           lynes.ednum=INSERT(rtext,lynes.ednum,found-1)
  3011.           IF ednum<4 & LEFT(lynes.1,6)='File: ' THEN
  3012.             DO
  3013.               PARSE VAR lynes.1 'File: 'filenum . 'KeyWords: 'keywords
  3014.               PARSE VAR lynes.3 . 'Lib:' libnam
  3015.               filenum=STRIP(filenum)
  3016.               newc=files.filenum.0
  3017.               libnum=finddirnum(libnam)
  3018.               alpha.newc=LEFT(WORD(lynes.2,2),22-LENGTH(WORD(lynes.2,4)))
  3019.               alpha.newc=alpha.newc WORD(lynes.2,4) RIGHT(filenum,5)
  3020.               alpha.newc=alpha.newc RIGHT(libnum,2) LEFT(STRIP(libnam),12)
  3021.               alpha.newc=alpha.newc STRIP(LEFT(STRIP(keywords),32))
  3022.               savefileflag=1
  3023.             END
  3024.           SAY 'Done.'CR
  3025.           SAY CR
  3026.           notchanged=0
  3027.         END
  3028.       ELSE IF edcom='I' THEN  /* insert */
  3029.         DO
  3030.           DO i=lynes.0 TO ednum BY -1
  3031.             j=i+1
  3032.             lynes.j=lynes.i
  3033.           END
  3034.           lynes.ednum=''
  3035.           notchanged=0
  3036.           lynes.0=lynes.0+1
  3037.           lynes.ednum=getinput(0 0 pen3||RIGHT(ednum,2)'>'def)
  3038.         END
  3039.       ELSE IF edcom='P' THEN   /* paste */
  3040.         DO
  3041.           DO i=lynes.0 TO ednum BY -1
  3042.             j=i+pasted.0
  3043.             lynes.j=lynes.i
  3044.           END
  3045.           DO k=1 TO pasted.0
  3046.             kk=ednum+k-1
  3047.             lynes.kk=pasted.k
  3048.           END
  3049.           notchanged=0
  3050.           lynes.0=lynes.0+pasted.0
  3051.         END
  3052.     END
  3053. END
  3054. RETURN 0
  3055.  
  3056.  
  3057. editor:
  3058. toname=''
  3059. msgnum=0
  3060. thechosen.=''
  3061. PARSE ARG edtype toname msgnum .
  3062. IF edtype='MAIL' THEN lastwrit=countcheck(bbspath'Numbers/LastMail 0')
  3063. ELSE 
  3064.   DO
  3065.     IF edtype='MSG' THEN
  3066.       DO
  3067.         tempmsgdir=0
  3068.         IF DATATYPE(arg,'W') THEN tempmsgdir=arg
  3069.         IF tempmsgdir>0 & tempmsgdir<=level & msg.tempmsgdir~='' THEN
  3070.           msgdir=tempmsgdir
  3071.         ELSE IF areaselect() THEN RETURN
  3072.       END
  3073.     lastwrit=countcheck(bbspath'Numbers/LastMessage'msgdir 0)
  3074.   END
  3075. IF toname='' THEN
  3076.   DO
  3077.     IF edtype='MAIL' THEN
  3078.       DO
  3079.         CALL selectchosen(1 pen3'Send PRIVATE' edtype lastwrit+1 'To: 'def)
  3080.         toname=thechosen.1
  3081.       END
  3082.     ELSE toname=getinput(1 0 pen3'Post A PUBLIC Message To: 'def)
  3083.   END
  3084. toname=SPACE(toname,1,'_')
  3085. toname=cleanstring(1':'toname)
  3086. IF toname='' | FIND(exclusion,toname)>0 THEN
  3087.   DO
  3088.     IF toname='' & edtype='MSG' THEN toname='ALL'
  3089.     ELSE toname=sysop
  3090.     SAY pen3'*** Re-Addressed to'def toname||CR
  3091.   END
  3092. IF toname~='ALL' THEN
  3093.   DO
  3094.     IF toname='BBBBS' THEN toname=sysop
  3095.     IF FIND(userlist,toname)=0 THEN
  3096.       DO
  3097.         IF courtesy='' THEN CALL loadcourtesy()
  3098.         IF FIND(courtesy,toname)=0 THEN
  3099.           DO
  3100.             SAY CR
  3101.             SAY bak2' 'toname' is not on the user list! 'def||CR
  3102.             IF edtype='MAIL' THEN
  3103.               DO
  3104.                 CALL showuserlist()
  3105.                 RETURN 0
  3106.               END
  3107.             ELSE
  3108.               DO
  3109.                 IF getinput(1 1 'Do you want to use it anyway? (nY) > ')='N' THEN
  3110.                   DO
  3111.                     IF getinput(1 1 'Do you want to see the list of current users? (Ny) > ')='Y' THEN
  3112.                       CALL showuserlist()
  3113.                     RETURN 0
  3114.                   END
  3115.               END
  3116.           END
  3117.       END
  3118.   END
  3119. IF edtype='MAIL' THEN
  3120.   DO
  3121.     CALL MAKEDIR(bbspath'EMail/'toname)
  3122.     mailname=bbspath'EMail/'toname'/'name'.'lastwrit+1
  3123.   END
  3124. ELSE
  3125.   DO
  3126.     CALL MAKEDIR(msgpath||msgdir)
  3127.     mailname=msgpath||msgdir'/'lastwrit+1
  3128.   END
  3129. lynes.=''
  3130. lynes.0=6
  3131. IF edtype='MAIL' THEN lynes.1=' Mail:' lastwrit+1  /* FILE: filename */
  3132. ELSE lynes.1='  Msg:' lastwrit+1          /* Msg: MSG# REPLY # # ... */
  3133. lynes.2=' From:' name
  3134. IF city~='' THEN lynes.2=lynes.2' - 'city
  3135. lynes.3='   To:' toname                       /*  To: toname   MSG # */
  3136. IF edtype='MAIL' THEN
  3137.   DO
  3138.     IF readopen(bbspath||'Users/'toname) THEN
  3139.       DO
  3140.         CALL READLN(f)
  3141.         CALL READLN(f)
  3142.         temp=READLN(f)
  3143.         CALL CLOSE(f)
  3144.         temp=docity(temp)
  3145.         IF temp~='' THEN lynes.3=lynes.3' - 'temp
  3146.       END
  3147.     IF replysubj='|@NEW@|' THEN
  3148.       DO
  3149.         CALL readlines(bbspath'BBS_TEXT/EMAIL_WELCOME' 7)
  3150.         replysubj='Welcome to' bbsname
  3151.       END
  3152.   END
  3153. subj=''
  3154. IF edtype='REPLY' THEN
  3155.   DO
  3156.     subj=SUBSTR(forthline,WORDINDEX(forthline,2))
  3157.     SAY pen3'Subj:'def subj||CR
  3158.     temp=getinput(0 0 'Change the current subject? (Ny) > ')
  3159.     IF LENGTH(temp)>3 THEN subj=temp
  3160.     ELSE IF LEFT(UPPER(temp),1)='Y' THEN subj=''
  3161.   END
  3162. ELSE IF edtype='MAIL' & replysubj~='' THEN subj=replysubj
  3163. IF subj='' THEN
  3164.   DO
  3165.     IF opt='C' THEN subj='FEEDBACK'
  3166.     ELSE
  3167.       DO
  3168.         SAY pen3'Enter the'def 'Subject' pen3'of this message (1 line).'def||CR
  3169.         subj=getinput(0 0 pen3': 'def)
  3170.       END
  3171.   END
  3172. IF LENGTH(subj)>66 THEN subj=LEFT(subj,66)
  3173. IF subj='' THEN subj='?'
  3174. lynes.4=' Subj:' subj
  3175. lynes.5=' Date:' DATE('W') DATE()'  'TIME('C')
  3176. IF edtype~='MAIL' THEN lynes.5=LEFT(lynes.5,39) 'Conference:' msg.msgdir
  3177. lynes.6=INSERT('','',1,74,'=')
  3178. IF edtype='REPLY' THEN lynes.3=lynes.3'  MSG 'msgnum
  3179. DO i=1 TO lynes.0
  3180.   SAY lynes.i||CR
  3181. END
  3182. CALL writebuffer(scratch'/MessageFile')
  3183. IF savelines(mailname) THEN RETURN 0
  3184. CALL seelines(1)
  3185. IF thechosen.0='' THEN
  3186.   DO
  3187.     thechosen.0=1
  3188.     thechosen.1=toname
  3189.   END
  3190. carbons=thechosen.0+1
  3191. DO FOREVER
  3192.   IF thechosen.0>=carbons THEN
  3193.     DO
  3194.       junk='Copies To:'
  3195.       DO cci=carbons TO thechosen.0
  3196.         junk=junk thechosen.cci
  3197.       END
  3198.       SAY junk||CR
  3199.     END
  3200.   pline=''
  3201.   IF edtype='MAIL' THEN pline='['pen3'C'def']opies'
  3202.   pline=STRIP(pline '['pen3'E'def']dit ['pen3'K'def']ill ['pen3'R'def']ead')
  3203.   pline=pline '['pen3'U'def']pload-Text ['pen3'S'def']end' edtype'? (ekrSu) 'def
  3204.   junk=getinput(1 1 pline)
  3205.   IF junk='E' THEN
  3206.     DO
  3207.       IF level>sysoplevel THEN firstedit=1
  3208.       ELSE firstedit=7
  3209.       IF bbsED(firstedit mailname)=2 THEN RETURN 0
  3210.       junk='R'
  3211.     END
  3212.   ELSE IF edtype='MAIL' & junk='C' THEN
  3213.     DO
  3214.       CALL selectchosen(carbons pen3'Carbon Copies To: 'def)
  3215.       junk='R'
  3216.     END
  3217.   ELSE IF junk='K' THEN
  3218.     DO
  3219.       IF DELETE(mailname)=1 THEN SAY edtype 'DELETED.'CR
  3220.       RETURN 0
  3221.     END
  3222.   ELSE IF junk='U' THEN
  3223.     DO
  3224.       CALL txup(0 mailname)
  3225.       junk='R'
  3226.     END
  3227.   IF junk='R' THEN
  3228.     DO
  3229.       CALL readlines(mailname 1)
  3230.       CALL seelines(1)
  3231.       nonstop=0
  3232.     END
  3233.   ELSE BREAK
  3234. END
  3235. IF edtype='MAIL' THEN
  3236.   DO
  3237.     IF replysubj~='' & readname~='' & LEFT(readname,5)~='BBBBS' & uname~='' & uname~='UNAME' THEN
  3238.       DO
  3239.         junk=getinput(1 1 'Attach original mail from' uname'? (nY) > ')
  3240.         IF junk~='N' THEN
  3241.           DO
  3242.             arg=bbspath'Email/'name'/'readname
  3243.             IF ~readlines(arg 1) THEN CALL savelines(mailname)
  3244.           END
  3245.       END
  3246.     junk=getinput(1 1 pen3'Attach a file to this message? (Ny) > 'def)
  3247.     IF junk='Y' THEN
  3248.       DO
  3249.         savearg=arg
  3250.         arg=getinput(0 0 'Filename: ')
  3251.         curdir=PRAGMA('D')
  3252.         CALL MAKEDIR(bbspath'EmailFiles/'toname)
  3253.         CALL setdir(bbspath'EmailFiles/'toname)
  3254.         DO WHILE uload(0)=2
  3255.         END
  3256.         IF WORD(STATEF(bbspath'EmailFiles/'toname'/'arg),2)>1 THEN
  3257.           DO
  3258.             CALL readlines(mailname 1)
  3259.             IF arg~='' THEN lynes.1=lynes.1'  FILE: 'arg
  3260.             CALL setdir(curdir)
  3261.             CALL DELETE(mailname)
  3262.             CALL savelines(mailname)
  3263.           END
  3264.         ELSE
  3265.           DO
  3266.             CALL DELETE(bbspath'EmailFiles/'toname'/'arg)
  3267.             SAY pen3'*** Upload failed! ***'def||CR
  3268.           END
  3269.         arg=savearg
  3270.       END
  3271.     totmail=WORD(data.17,2)
  3272.     IF ~DATATYPE(totmail,'W') THEN totmail=1
  3273.     ELSE totmail=totmail+1
  3274.     data.17=WORD(data.17,1)'  'totmail'  'WORD(data.17,3)
  3275.   END
  3276. IF edtype~='MAIL' THEN totwrit.msgdir=totwrit.msgdir+1
  3277. CALL readlines(mailname 1)
  3278. DO ui=1 TO thechosen.0
  3279.   IF thechosen.ui='' THEN ITERATE ui
  3280.   IF ui>1 THEN
  3281.     DO
  3282.       CALL MAKEDIR(bbspath'Email/'thechosen.ui)
  3283.       newname=bbspath'Email/'thechosen.ui'/'name'.'lastwrit+1
  3284.       IF ui<carbons THEN lynes.3='   To:' thechosen.ui
  3285.       ELSE
  3286.         DO
  3287.           lynes.1=lynes.1'  (Carbon Copy)'
  3288.           lynes.3='   To:' thechosen.1
  3289.         END
  3290.       CALL savelines(newname)
  3291.       IF WORDS(lynes.1)>3 & EXISTS(bbspath'EmailFiles/'thechosen.1'/'WORD(lynes.1,4)) THEN
  3292.         DO
  3293.           CALL MAKEDIR(bbspath'EmailFiles/'thechosen.ui)
  3294.           ADDRESS COMMAND 'C:COPY' bbspath'EmailFiles/'thechosen.1'/'WORD(lynes.1,4) bbspath'EmailFiles/'thechosen.ui
  3295.           line2='Copied' WORD(lynes.1,4)
  3296.           SAY line2 'to the' thechosen.ui 'file area.'CR
  3297.           CALL send2log(line2)
  3298.         END
  3299.     END
  3300.   line=edtype':'lastwrit+1 'at' TIME('C') 'to' thechosen.ui
  3301.   IF edtype~='MAIL' THEN
  3302.     DO
  3303.       IF FIND(userlist,thechosen.ui)>0 THEN
  3304.         CALL msgmark(thechosen.ui msgdir lastwrit+1)
  3305.       line=line 'in' msg.msgdir
  3306.     END
  3307.   CALL send2log(line)
  3308.   line=edtype 'Sent To' thechosen.ui
  3309.   IF edtype='MAIL' THEN
  3310.     DO
  3311.       IF emailonline>=0 THEN emailonline=emailonline+1
  3312.     END
  3313.   ELSE
  3314.     DO
  3315.       grand=grand+1
  3316.       IF ~DATATYPE(msg.msgdir.0,'W') THEN msg.msgdir.0=1
  3317.       ELSE msg.msgdir.0=msg.msgdir.0+1
  3318.       line=line 'in the'pen3 msg.msgdir def'conference.'
  3319.     END
  3320.   SAY line||CR
  3321. END
  3322. IF edtype='MAIL' THEN CALL countcheck(bbspath'Numbers/LastMail' lastwrit+1)
  3323. ELSE CALL countcheck(bbspath'Numbers/LastMessage'msgdir lastwrit+1)
  3324. CALL setdir(libpath||dirs.1)
  3325. thechosen.=''
  3326. RETURN 1
  3327.  
  3328.  
  3329. txup:
  3330. PARSE ARG upflg uparg .
  3331. SAY 'Ready to append' pen3'TEXT ONLY'def 'using'pen3 protocol||def||CR
  3332. pline='Are you SURE your file is un-compressed text? (Ny) > '
  3333. IF getinput(1 1 pline)='Y' THEN
  3334.   DO
  3335.     savearg=arg
  3336.     arg='UploadFile'
  3337.     curdir=PRAGMA('D')
  3338.     CALL setdir(scratch)
  3339.     CALL DELETE(arg)
  3340.     CALL DELETE('tempfile1')
  3341.     IF uload(0)=0 THEN
  3342.       DO
  3343.         IF upflg=0 THEN
  3344.           DO
  3345.             ADDRESS COMMAND 'C:copy' uparg 'tempfile1'
  3346.             CALL DELETE(uparg)
  3347.             ADDRESS COMMAND 'C:join tempfile1 UploadFile AS' uparg
  3348.           END
  3349.         ELSE IF upflg=1 THEN
  3350.           DO
  3351.             CALL readlines(arg lynes.0+1)
  3352.             notchanged=0
  3353.           END
  3354.       END
  3355.     CALL setdir(curdir)
  3356.     arg=savearg
  3357.   END
  3358. RETURN
  3359.  
  3360.  
  3361. msgmark:
  3362. PARSE ARG markname markdir markmsg .
  3363. IF OPEN(f,bbspath'Users/'markname)=0 THEN RETURN
  3364. mlines.=''
  3365. DO mi=1 TO 24
  3366.   mlines.mi=READLN(f)
  3367. END
  3368. mlines.24=STRIP(mlines.24 markdir'/'markmsg)
  3369. CALL SEEK(f,0,'B')
  3370. DO mi=1 TO 24
  3371.   CALL WRITELN(f,mlines.mi)
  3372. END
  3373. CALL CLOSE(f)
  3374. RETURN
  3375.  
  3376.  
  3377. shell:
  3378. SAY CR
  3379. olddir=PRAGMA('D')
  3380. DO WHILE(UPPER(opt)~='EXIT')
  3381.   SAY bak2||TIME('C')||def PRAGMA('D')||CR
  3382.   OPTIONS PROMPT pen3'Type EXIT to quit AmigaDOS> 'def
  3383.   PARSE PULL opt' 'arg
  3384.   CALL checkdcd()
  3385.   IF(UPPER(opt)='CD') THEN CALL setdir(arg)
  3386.   ELSE IF exists(opt)~=0 THEN
  3387.     DO
  3388.       IF LEFT(STATEF(opt),3)='DIR' THEN CALL setdir(opt)
  3389.     END
  3390.   ELSE IF opt~='' & UPPER(opt)~='EXIT' THEN
  3391.     ADDRESS COMMAND opt '<* >*' arg
  3392. END
  3393. CALL PRAGMA('D',olddir)
  3394. RETURN
  3395.  
  3396.  
  3397. yell:
  3398. chatrequest=1
  3399. IF excuses.1='' THEN
  3400.   DO
  3401.     IF readopen(bbspath'Lists/Excuses') THEN
  3402.       DO
  3403.         DO i=1
  3404.           line=READLN(f)
  3405.           IF EOF(f) THEN BREAK
  3406.           excuses.i=line
  3407.         END
  3408.         excuses.0=i-1
  3409.         CALL CLOSE(f)
  3410.       END
  3411.   END
  3412. j=TIME('S')//excuses.0+1
  3413. SAY CR
  3414. SAY 'Sorry, your SysOp,' sysop','CR
  3415. IF excuses.j~='' THEN SAY excuses.j||CR
  3416. ELSE SAY 'is not available, please leave a ['pen3'C'def']omment.'CR
  3417. SAY CR
  3418. IF bbsprefs.13 THEN RETURN
  3419. SAY 'I''m yelling anyway...'CR
  3420. SAY 'If nobody answers, please try again later or leave a ['pen3'C'def']omment'CR
  3421. CALL sound('YELL')
  3422. IF SHOWLIST('H','SPEAK') THEN  /* check on SPEAK: device */
  3423.   DO
  3424.     IF EXISTS(bbspath'BBS_TEXT/YELL') THEN /* we have yell file */
  3425.       ADDRESS COMMAND 'C:Run C:Type >SPEAK:' bbspath'BBS_TEXT/YELL'
  3426.     ELSE IF writeopen('SPEAK:')~=0 THEN
  3427.       DO
  3428.         CALL WRITELN(f,'Yo sissop.')
  3429.         CALL WRITELN(f,'A uzer wants to chat with you.')
  3430.         CALL WRITELN(f,'Yo sissop.')
  3431.         CALL CLOSE(f)
  3432.       END
  3433.   END
  3434. ELSE IF EXISTS(saypath) THEN          /* default to SAY */
  3435.   DO
  3436.     IF EXISTS(bbspath'BBS_TEXT/YELL') THEN /* we have yell file */
  3437.       ADDRESS COMMAND 'C:Run' saypath '-x' bbspath'BBS_TEXT/YELL'
  3438.     ELSE
  3439.       DO
  3440.         ADDRESS COMMAND saypath 'Yo sissop.'
  3441.         ADDRESS COMMAND saypath 'A uzer wants to chat with you.'
  3442.         ADDRESS COMMAND saypath 'Yo sissop.'
  3443.       END
  3444.   END
  3445. RETURN
  3446.  
  3447.  
  3448. /* online change to member. Sysop triggered by BumpMember.baud */
  3449. validate:
  3450. IF readopen(bbspath'BBS_TEXT/DEF.MEMBER') THEN
  3451.   DO
  3452.     SAY CR
  3453.     SAY 'You are being validated.  Please wait...'CR
  3454.     SAY CR
  3455.     DO lvi=1 TO 22
  3456.       line=READLN(f)
  3457.       IF lvi=11 THEN data.11=line
  3458.       IF lvi=20 THEN data.20=line
  3459.       IF lvi=21 THEN data.21=line
  3460.     END
  3461.     data.22=line
  3462.     CALL CLOSE(f)
  3463.     CALL SetData()
  3464.     CALL sortlibraries()
  3465.     CALL logonstats()
  3466.     CALL saveData(0)
  3467.     SIGNAL RESTART
  3468.   END
  3469. ELSE MSG bak2'You need a default member file in BBS_TEXT!   ( BBS_TEXT/DEF.MEMBER )'def
  3470. RETURN
  3471.  
  3472.  
  3473. /* online time change. Sysop triggered by BumpTime.baud */
  3474. uptime:
  3475. mins=GETCLIP('BBS_minutes')
  3476. IF DATATYPE(mins,'N') THEN
  3477.   DO
  3478.     IF (mins*60)>maxtime THEN
  3479.       SAY name', this session''s time has been increased to' mins 'minutes.'CR
  3480.     ELSE MSG '*** User has not been told that his time has decreased.'
  3481.     CALL SETCLIP('BBS_minutes')
  3482.     maxtime=mins*60
  3483.   END
  3484. RETURN
  3485.  
  3486.  
  3487. /* online level change. Sysop triggered by BumpLevels.baud */
  3488. uplevel:
  3489. levl=GETCLIP('BBS_level')
  3490. IF DATATYPE(levl,'W') THEN
  3491.   DO
  3492.     IF levl>data.20 THEN
  3493.       SAY name', your level has been changed from' data.20 'to' levl'.'CR
  3494.     ELSE MSG '*** User has not been told his level has been reduced.'
  3495.     data.20=levl
  3496.     CALL SetData()
  3497.     IF menu='NEW' THEN menu='ALL'
  3498.     CALL sortlibraries()
  3499.   END
  3500. RETURN
  3501.  
  3502.  
  3503. /* online ratio change. Sysop triggered by BumpLevels.baud */
  3504. upratio:
  3505. rats=GETCLIP('BBS_ratio')
  3506. IF DATATYPE(rats,'W') THEN
  3507.   DO
  3508.     SAY name', your upload:download ratio has been changed to 1:'rats'.'CR
  3509.     data.17=rats'  'WORD(data.17,2)'  'WORD(data.17,3)
  3510.     CALL SETCLIP('BBS_ratio')
  3511.   END
  3512. RETURN
  3513.  
  3514.  
  3515. bytes2user:
  3516. PARSE ARG indx bytes .
  3517. tfiles=WORD(data.indx,1)
  3518. tbytes=WORD(data.indx,3)
  3519. IF ~DATATYPE(tfiles,'W') THEN tfiles=0
  3520. IF ~DATATYPE(tbytes,'W') THEN tbytes=0
  3521. tbytes=tbytes+bytes
  3522. tfiles=tfiles+1
  3523. IF tfiles>1 THEN data.indx=tfiles 'files' tbytes 'bytes.'
  3524. ELSE data.indx='1 file' bytes 'bytes.'
  3525. data.indx=data.indx DATE()
  3526. CALL saveData(0)
  3527. RETURN
  3528.  
  3529.  
  3530. stats:
  3531. ARG indx
  3532. tfail=''
  3533. bytes=''
  3534. Status z
  3535. string=RESULT
  3536. IF RIGHT(BB_VERS,4)>1.59 THEN
  3537.   DO
  3538.     PARSE VAR string . 'Local Name: 'temp . 'Xfer''ed: 'bytes . 'Elapsed Time: 'min':'sec'0A'x .
  3539.     slash=LASTPOS('/',temp)
  3540.     IF slash=0 THEN slash=LASTPOS(':',temp)
  3541.     IF slash~=0 THEN temp=SUBSTR(temp,slash+1)
  3542.   END
  3543. ELSE PARSE VAR string temp' 'min':'sec . 'Bytes:'bytes .
  3544. temp=STRIP(temp)
  3545. min=STRIP(min)
  3546. sec=STRIP(sec)
  3547. bytes=STRIP(bytes)
  3548. IF temp~='' & LEFT(UPPER(STRIP(temp)),8)~=LEFT(UPPER(arg),8) THEN
  3549.   tfail='wrong file' temp
  3550. ELSE IF DATATYPE(min,'W') & DATATYPE(sec,'W') & DATATYPE(bytes,'W') THEN
  3551.   DO
  3552.     secs=(min*60)+sec
  3553.     IF indx=14 THEN CALL DELAY(100) /* wait for dos to finish upload */
  3554.     temp=STATEF(PRAGMA('D')'/'arg)
  3555.     temp=WORD(temp,2)
  3556.     IF ~DATATYPE(temp,'W') THEN temp=0
  3557.     IF indx=14 & (temp+1024)<bytes THEN tfail='ul size'
  3558.     IF indx=15 & temp>(bytes+1024) THEN tfail='dl size'
  3559.   END
  3560. ELSE tfail='not numeric: min='min 'sec='sec 'bytes='bytes
  3561. IF tfail~='' THEN
  3562.   DO
  3563.     line=plaindir'/'arg pen3'*** Transfer failed! ***'def
  3564.     SAY line||CR
  3565.     CALL send2log(line 'tfail:'tfail)
  3566.     CALL send2log('***' string)
  3567.     Remote OFF
  3568.     Send '^G\w^G^G'
  3569.     Remote ON
  3570.     RETURN 1
  3571.   END
  3572. ELSE IF secs>0 THEN
  3573.   Say 'Transfer Speed:' TRUNC(bytes/secs+.05,1) 'characters per second.'CR
  3574. Remote OFF
  3575. Send '^G'
  3576. Remote ON
  3577. line=left(arg,16,' ')
  3578. IF indx=14 THEN
  3579.   DO
  3580.     temp=countcheck(bbspath'Numbers/Bytes.UpLoad' 0)+bytes
  3581.     CALL countcheck(bbspath'Numbers/Bytes.UpLoad' temp)
  3582.     line=line 'uled'
  3583.   END
  3584. ELSE
  3585.   DO
  3586.     temp=countcheck(bbspath'Numbers/Bytes.DownLoad' 0)+bytes
  3587.     CALL countcheck(bbspath'Numbers/Bytes.DownLoad' temp)
  3588.     temp=countcheck(bbspath'Numbers/Files.DownLoad' 0)+1
  3589.     CALL countcheck(bbspath'Numbers/Files.DownLoad' temp)
  3590.     temp=PRAGMA('D')
  3591.     xdev=SPACE(LEFT(temp,POS(':',temp)-1),1,'_')
  3592.     tfiles=1
  3593.     IF EXISTS(arg'.xdl') THEN
  3594.       DO
  3595.         IF readopen(arg'.xdl') THEN
  3596.           DO
  3597.             xdev=READLN(f)
  3598.             tfiles=READLN(f)
  3599.             CALL CLOSE(f)
  3600.           END
  3601.       END
  3602.     temp=countcheck(bbspath'Numbers/Bytes.X.'xdev 0)+bytes
  3603.     CALL countcheck(bbspath'Numbers/Bytes.X.'xdev temp)
  3604.     temp=countcheck(bbspath'Numbers/Files.X.'xdev 0)+tfiles
  3605.     CALL countcheck(bbspath'Numbers/Files.X.'xdev temp)
  3606.     line=line 'dled'
  3607.   END
  3608. line=line protocol TIME('C') bytes 'bytes' PRAGMA('D')
  3609. CALL send2log(line)
  3610. RETURN 0
  3611.  
  3612.  
  3613. bbsspace:
  3614. ARG tabspace .
  3615. ADDRESS COMMAND 'C:info >ram:infout' bbsdevice
  3616. ok=OPEN(f,'ram:infout','R')
  3617. IF ok=0 THEN RETURN 20
  3618. line=READLN(f)
  3619. line=READLN(f)
  3620. line=READLN(f)
  3621. line=READLN(f)
  3622. CALL CLOSE(f)
  3623. IF tabspace<14 THEN SAY CR
  3624. bbsk=WORD(line,4)
  3625. IF ~DATATYPE(bbsk,'N') THEN
  3626.   DO
  3627.     line=bbsdevice 'is not an info compatible device!'
  3628.     CALL send2log(line)
  3629.     SAY pen3||line||def||CR
  3630.     bbsk=0
  3631.     RETURN
  3632.   END
  3633. bbsk=bbsk*512-SYSTEM_SPACE_LIMIT
  3634. IF bbsk<1 THEN bbsk=0
  3635. SAY RIGHT(comma(bbsk),tabspace) 'bytes available for uploads.'CR
  3636. RETURN
  3637.  
  3638.  
  3639. comma:
  3640. ARG num .
  3641. dgt=LENGTH(num)
  3642. numtext=''
  3643. IF dgt>3 THEN numtext=','RIGHT(num,3)
  3644. IF dgt>6 THEN numtext=','LEFT(RIGHT(num,6),3)||numtext
  3645. IF dgt>9 THEN numtext=','LEFT(RIGHT(num,9),3)||numtext
  3646. IF dgt>12 THEN
  3647.   DO
  3648.     numtext=','LEFT(RIGHT(num,12),3)||numtext
  3649.     numtext=LEFT(num,dgt-12)||numtext
  3650.   END
  3651. ELSE IF dgt>9 THEN numtext=LEFT(num,dgt-9)||numtext
  3652. ELSE IF dgt>6 THEN numtext=LEFT(num,dgt-6)||numtext
  3653. ELSE IF dgt>3 THEN numtext=LEFT(num,dgt-3)||numtext
  3654. ELSE numtext=num
  3655. RETURN numtext
  3656.  
  3657.  
  3658. is_here:
  3659. ARG newname 
  3660. SAY 'Checking filelist...'CR
  3661. filenum=countcheck(bbspath'Numbers/LastFile' 0)
  3662. DO ui=1 TO filenum
  3663.   IF UPPER(WORD(files.ui,2))~=newname THEN ITERATE ui
  3664.   temp=WORD(files.ui,1)
  3665.   line=pen3'*** File' newname 'already exists here in the'
  3666.   line=line temp 'directory.'def
  3667.   SAY line||CR
  3668.   temp=files.ui.0
  3669.   IF DATATYPE(temp,'W') THEN SAY alpha.temp||CR
  3670.   SAY 'Original uploader should ['pen3'K'def']ill the file before uploading the replacement.'CR
  3671.   RETURN 1
  3672. END
  3673. CALL cleanline(1)
  3674. RETURN 0
  3675.  
  3676.  
  3677. uload:
  3678. ARG frommenu
  3679. IF frommenu THEN
  3680.   DO
  3681.     SAY CR
  3682.     SAY pen3'PLEASE!'def 'Only upload 1 (one) file at a time. NO MULTIPLE UPLOADS! Thanks.'CR
  3683.   END
  3684. CALL bbsspace(12)
  3685. SAY CR
  3686. IF bbsk<1 THEN
  3687.   DO
  3688.     line='Upload area is full!'
  3689.     CALL send2log(line)
  3690.     SAY pen3||line||def||CR
  3691.     RETURN 1
  3692.   END
  3693. IF arg='' THEN arg=getinput(0 0 'Filename: ')  /* no filename given */
  3694. arg=cleanstring('0:'arg)
  3695. arg=COMPRESS(arg,' :/,;|#?*')  /* be sure no illegals here */
  3696. tempnum=LENGTH(arg)-16
  3697. DO WHILE tempnum>0
  3698.   temp='          'pen3||arg def'is'pen3 tempnum||def
  3699.   IF tempnum=1 THEN temp=temp 'character'
  3700.   ELSE temp=temp 'characters'
  3701.   temp=temp 'too long for a filename.'
  3702.   SAY temp||CR
  3703.   arg=getinput(0 0 'Filename: ')
  3704.   arg=cleanstring('0:'arg)
  3705.   arg=COMPRESS(arg,' :/,;|#?*')
  3706.   tempnum=LENGTH(arg)-16
  3707. END
  3708. IF arg='' THEN RETURN 1
  3709. IF frommenu THEN
  3710.   DO
  3711.     IF is_here(arg) THEN RETURN 1
  3712.     IF bbsprefs.6=1 & sysoplevel>level THEN CALL setdir(libpath'Sysops')
  3713.     ELSE
  3714.       DO loop=1
  3715.         SAY 'Please select an appropriate library for -' pen3||arg def'-'CR
  3716.         IF chdir()=0 THEN LEAVE loop
  3717.       END
  3718.   END
  3719. checkproto='T'
  3720. targ=arg
  3721. DO WHILE checkproto='T'
  3722.   arg=''
  3723.   SAY CR
  3724.   SAY 'Library:'pen3 plaindir def'  Filename:'pen3 targ def'  Protocol:'pen3 protocol||def||CR
  3725.   pline=' ['pen3'Q'def']uit ['pen3'T'def']ransfer-protocol'
  3726.   pline=pline '['pen3'U'def']pload (qtU) > '
  3727.   checkproto=getinput(1 1 pline)
  3728.   IF checkproto='Q' THEN RETURN 1
  3729.   IF checkproto='T' THEN CALL chpro()
  3730. END
  3731. arg=targ
  3732. CALL postuser(4)
  3733. uploadtime=TIME('E')
  3734. SAY 'Starting' protocol 'transfer.  Press' pen3'Esc'def 'to abort.'CR
  3735. CALL whodat()
  3736. DownLoad arg
  3737. IF RC>0 | stats(14) THEN RETURN 2
  3738. rbytes=WORD(STATEF(arg),2)
  3739. IF rbytes<1 THEN
  3740.   DO
  3741.     CALL DELETE(arg)
  3742.     RETURN 2
  3743.   END
  3744. temp=''
  3745. DO WHILE temp~='N' & temp~='Y'
  3746.   temp=getinput(1 1 'Received' rbytes 'bytes. Was your upload successful? (ny) > ')
  3747. END
  3748. IF temp='N' THEN RETURN 2
  3749. IF TestArc.rexx(PRAGMA('D')'/'arg)>0 THEN
  3750.   DO
  3751.     SAY CR
  3752.     SAY pen3'***'def arg pen3'failed archive check!'def||CR
  3753.     SAY CR
  3754.     temp=getinput(1 1 'Do you believe the archive checker made a mistake? (Ny) > ')
  3755.     IF temp~='Y' THEN
  3756.       DO
  3757.         CALL DELETE(arg)
  3758.         SAY CR
  3759.         RETURN 2
  3760.       END
  3761.   END
  3762. CALL bytes2user(14 rbytes)
  3763. ADDRESS AREXX bbsNewFile.rexx name PRAGMA('D')'/'arg
  3764. IF bbsprefs.9 & name~=sysop THEN
  3765.   DO
  3766.     newufile=bbspath'EMail/'sysop'/NEW_FILES'
  3767.     IF EXISTS(newufile) THEN ok=OPEN(f,newufile,'A')
  3768.     ELSE
  3769.       DO
  3770.         ok=OPEN(f,newufile,'W')
  3771.         IF ok~=0 THEN CALL WRITELN(f,'*** New Files ***') 
  3772.       END
  3773.     IF ok~=0 THEN CALL WRITELN(f,name 'uploaded' plaindir'/'arg'  'DATE() TIME())
  3774.     CALL CLOSE(f)
  3775.   END
  3776. IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN 0
  3777. DO ui=sysoplevel+2 TO 100
  3778.   IF UPPER(dirs.ui)=UPPER(plaindir) THEN RETURN 0     /* no filenotes */
  3779. END
  3780. IF frommenu THEN
  3781.   DO
  3782.     uploadtime=TIME('E')-uploadtime
  3783.     IF bbsprefs.11 THEN
  3784.       DO
  3785.         maxtime=maxtime+uploadtime
  3786.         line='This session''s time has been increased by'
  3787.         line=line TRUNC(uploadtime%60+.05,1)+1 'minutes.'
  3788.         SAY CR
  3789.         SAY line||CR
  3790.       END
  3791.     DO WHILE editnote(arg)  /* INSIST on a filenote */
  3792.     END
  3793.     SAY pen3'Thank you for contributing to the' bbsname 'file libraries!'def||CR
  3794.   END
  3795. waitchar=''
  3796. RETURN 0
  3797.  
  3798.  
  3799. findfiles:
  3800. PARSE ARG ffile .
  3801. IF POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN ffile
  3802. IF DATATYPE(ffile,'W') THEN
  3803.   DO
  3804.     IF WORDS(files.ffile)<2 THEN RETURN 0
  3805.     dirtemp=WORD(files.ffile,1)
  3806.     IF finddirnum(dirtemp)>level | FIND(data.21,UPPER(dirtemp))>0 THEN
  3807.       DO
  3808.         CALL illegal_access()
  3809.         RETURN 0
  3810.       END
  3811.     CALL setdir(libpath||dirtemp)
  3812.   END
  3813. ELSE IF EXISTS(ffile) THEN
  3814.   DO
  3815.     IF EXISTS(bbspath'FileNotes/'plaindir'/'ffile) THEN
  3816.       DO
  3817.         IF readopen(bbspath'FileNotes/'plaindir'/'ffile)~=0 THEN
  3818.           DO
  3819.             line=READLN(f)
  3820.             CALL CLOSE(f)
  3821.             ffile=WORD(line,2)
  3822.           END
  3823.       END
  3824.   END
  3825. ELSE
  3826.   DO
  3827.     nextfilenum=countcheck(bbspath'Numbers/LastFile' 0)+1
  3828.     DO ui=nextfilenum TO 0 BY -1
  3829.       IF ui<1 THEN
  3830.         DO
  3831.           SAY CR
  3832.           SAY '***' files.0 'filenames scanned,'pen3 ffile def'is not on the filelist!'CR
  3833.           SAY CR
  3834.           RETURN 0
  3835.         END
  3836.       argtemp=WORD(files.ui,2)
  3837.       IF UPPER(argtemp)=UPPER(ffile) THEN
  3838.         DO
  3839.           dirtemp=WORD(files.ui,1)
  3840.           jj=files.ui.0
  3841.           IF WORD(alpha.jj,4)>level | FIND(data.21,UPPER(dirtemp))>0 THEN
  3842.             DO
  3843.               CALL illegal_access()
  3844.               RETURN 0
  3845.             END
  3846.           ffile=ui
  3847.           CALL setdir(libpath||dirtemp)
  3848.           LEAVE ui
  3849.         END
  3850.     END
  3851.   END
  3852. ftemp=ffile
  3853. IF DATATYPE(ftemp,'W') THEN ftemp=WORD(files.ftemp,2)
  3854. IF ~EXISTS(ftemp) THEN
  3855.   DO
  3856.     finfo=STATEF(bbspath'FileNotes/'plaindir'/'ftemp)
  3857.     IF WORDS(finfo)>7 THEN ftemp=WORD(finfo,8)
  3858.     IF ~EXISTS(ftemp) THEN
  3859.       DO
  3860.         IF finfo='' THEN SAY '***'pen3 PRAGMA('D')'/'ftemp def'was not found!'CR
  3861.         ELSE
  3862.           DO
  3863.             SAY CR
  3864.             SAY '***'pen3 plaindir'/'ftemp def'is not currently available online.'CR
  3865.             SAY 'Please leave email to your sysop'pen3 sysop||def', to receive this file.'CR
  3866.             SAY CR
  3867.           END
  3868.         RETURN 0
  3869.       END
  3870.   END
  3871. RETURN ffile
  3872.  
  3873.  
  3874. illegal_access:
  3875. SAY CR
  3876. SAY '*** You are not authorized to access' ffile'!'CR
  3877. SAY '*** Send Email to' sysop 'to receive a higher level.'CR
  3878. SAY CR
  3879. IF DATATYPE(ffile,'W') THEN ffile=ffile WORD(files.ffile,2)
  3880. CALL send2log('Illegal Access Attempt!' ffile 'in' dirtemp)
  3881. RETURN
  3882.  
  3883.  
  3884. statuscheck:
  3885. PARSE ARG ffile
  3886. updownratio=WORD(data.17,1)
  3887. IF ~DATATYPE(updownratio,'N') THEN updownratio=100
  3888. upbytes=WORD(data.14,3)
  3889. IF ~DATATYPE(upbytes,'W') | upbytes<1 THEN upbytes=1
  3890. dnbytes=WORD(data.15,3)
  3891. IF ~DATATYPE(dnbytes,'W') | dnbytes<1 THEN dnbytes=1
  3892. dbytes=WORD(STATEF(ffile),2)
  3893. IF ~DATATYPE(dbytes,'W') THEN dbytes=1
  3894. IF ~DATATYPE(bps,'W') THEN bps=2400
  3895. needtime=dbytes%(bps%10)+10  /* plus 10 seconds for handshaking? */
  3896. SAY CR
  3897. SAY CR
  3898. CALL showtime()
  3899. SAY 'At least' TRUNC(needtime/60+.05,1) 'minutes needed to download' ffile 'at' bps 'baud.'CR
  3900. SAY 'After this transfer your upload:download ratio will be 1:'TRUNC((dbytes+dnbytes)/upbytes)||CR
  3901. IF level>(sysoplevel+1) | POS('EMAILFILES',UPPER(PRAGMA('D')))>0 THEN RETURN 0
  3902. IF (needtime+TIME('E'))>maxtime THEN
  3903.   DO
  3904.     SAY CR
  3905.     SAY 'Sorry, not enough time left in this session to download' dbytes 'bytes.'CR
  3906.     CALL send2log(needtime%60 'mins needed to dl' ffile 'at' dbytes 'bytes!'def)
  3907.     IF needtime>(WORD(data.11,1)*60) THEN
  3908.       SAY 'Leave email to the sysop to make other arrangements to receive this file.'CR
  3909.     SAY CR
  3910.     RETURN 1
  3911.   END
  3912. IF updownloadratio>0 & (dnbytes/upbytes)>updownratio THEN
  3913.   DO
  3914.     SAY CR
  3915.     line=pen3'       *** You must upload before you do any more downloading! ***'def
  3916.     SAY line||CR
  3917.     CALL send2log('*** Exceeded Download Ratio 1:'TRUNC(dnbytes/upbytes))
  3918.     SAY '  Maintain a ratio of at least 1 byte uploaded for each' updownratio 'bytes downloaded.'CR
  3919.     IF bbsprefs.4 THEN RETURN 1
  3920.     SAY pen3'             - This requirement is temporarily suspended. -'def||CR
  3921.     SAY CR
  3922.   END
  3923. RETURN 0
  3924.  
  3925.  
  3926. ext_dload:
  3927. SAY CR
  3928. CALL checkdcd()
  3929. allargs=bbsExtDL.baud(name level TRUNC(maxtime-TIME('E')) linesperpage colorflag extdevs)
  3930. IF allargs='' | TRUNC(maxtime-TIME('E'))<30 THEN RETURN
  3931. CALL dload2()
  3932. RETURN
  3933.  
  3934.  
  3935. dload:
  3936. arg=STRIP(arg data.25)
  3937. data.25=''
  3938. curdir=PRAGMA('D')
  3939. OPTIONS PROMPT 'Filenames and/or numbers: '
  3940. IF arg='' THEN PARSE PULL arg  /* no filename given */
  3941. IF arg='' THEN RETURN 0
  3942. allargs=TRANSLATE(arg,'     ',':/,;|')
  3943. tempargs=SPACE(allargs,1)
  3944. SAY 'Working...'lineup||CR
  3945. IF POS('EMAILFILES',curdir)=0 THEN
  3946.   DO di=1 TO WORDS(tempargs) WHILE STRIP(allargs)~=''
  3947.     arg=WORD(tempargs,di)
  3948.     wloc=WORDINDEX(allargs,FIND(allargs,arg))
  3949.     temp=findfiles(arg)
  3950.     IF temp~=arg THEN
  3951.       DO
  3952.         allargs=DELWORD(allargs,FIND(allargs,arg),1)
  3953.         IF temp~=0 THEN allargs=INSERT(temp' ',allargs,wloc-1)
  3954.       END
  3955.   END
  3956.  
  3957. dload2:
  3958. curdir=PRAGMA('D')
  3959. allargs=STRIP(data.25 allargs)
  3960. data.25=''
  3961. IF allargs='' THEN RETURN 0
  3962. sleepy='T'
  3963. DO WHILE sleepy='T'
  3964.   arg=''
  3965.   SAY CR
  3966.   temp=WORD(allargs,1)
  3967.   IF DATATYPE(temp,'W') THEN temp=WORD(files.temp,2)
  3968.   test=''
  3969.   IF LENGTH(temp)>40 THEN
  3970.     DO
  3971.       test=temp
  3972.       temp=''
  3973.     END
  3974.   SAY 'Filename(s)'pen3 LEFT(temp,40) def'Protocol:'pen3 protocol||def||CR
  3975.   IF test~='' THEN SAY '           'pen3 test||def||CR
  3976.   DO di=2 TO WORDS(allargs) /* emailfile will not get here */
  3977.     temp=WORD(allargs,di)
  3978.     IF DATATYPE(temp,'W') THEN temp=WORD(files.temp,2)
  3979.     SAY '           'pen3 temp||def||CR
  3980.   END
  3981.   pline='['pen3'A'def']uto-Logoff-after-transfer ['pen3'D'def']ownload'
  3982.   pline=pline '['pen3'Q'def']uit ['pen3'T'def']ransfer-protocol (aDqt)'
  3983.   sleepy=getinput(1 1 pline '> ')
  3984.   IF sleepy='Q' THEN RETURN 0
  3985.   IF sleepy='A' THEN sleepy='LOGOFF'
  3986.   IF sleepy='T' THEN CALL chpro()
  3987. END
  3988. DO WHILE allargs~=''
  3989.   errorflag=0
  3990.   extdir=''
  3991.   arg=WORD(allargs,1)
  3992.   allargs=STRIP(DELWORD(allargs,1,1))
  3993.   IF DATATYPE(arg,'W') THEN
  3994.     DO
  3995.       CALL setdir(libpath||WORD(files.arg,1))
  3996.       arg=WORD(files.arg,2)
  3997.     END
  3998.   notename=bbspath'FileNotes/'plaindir'/'arg
  3999.   finfo=''
  4000.   IF ~EXISTS(arg) THEN
  4001.     DO
  4002.       finfo=STATEF(notename)
  4003.       IF WORDS(finfo)>7 THEN
  4004.         DO
  4005.           temp=plaindir
  4006.           x=lastslash(WORD(finfo,8))
  4007.           arg=WORD(x,1)
  4008.           CALL setdir(WORD(x,2))
  4009.           plaindir=temp
  4010.         END
  4011.     END
  4012.   x=lastslash(arg)
  4013.   IF WORDS(x)>1 THEN
  4014.     DO
  4015.       arg=WORD(x,1)
  4016.       extdir=WORD(x,2)
  4017.       CALL setdir(extdir)
  4018.     END
  4019.   DO dloadloop=1
  4020.     IF statuscheck(arg) THEN
  4021.       DO
  4022.         errorflag=1
  4023.         LEAVE dloadloop
  4024.       END
  4025.     CALL postuser(5)
  4026.     SAY 'Starting' protocol 'transfer.  Press' pen3'Esc'def 'to abort.'CR
  4027.     CALL checktime()
  4028.     UpLoad arg
  4029.     IF RC>0 | stats(15) THEN
  4030.       DO
  4031.         errorflag=1
  4032.         LEAVE dloadloop
  4033.       END
  4034.     CALL bytes2user(15 WORD(STATEF(arg),2))
  4035.     IF extdir='' & POS('EMAILFILES',UPPER(PRAGMA('D')))=0 THEN
  4036.       DO dloadloop2=1 TO 1
  4037.         DO di=sysoplevel+2 TO 100
  4038.           IF UPPER(dirs.di)=UPPER(plaindir) THEN LEAVE dloadloop2
  4039.         END
  4040.         IF readlines(notename 1) THEN
  4041.           DO
  4042.             CALL send2log('Unable to increment download count for' plaindir'/'arg)
  4043.             LEAVE dloadloop2
  4044.           END
  4045.         dls=WORD(lynes.2,7)
  4046.         IF ~DATATYPE(dls,'W') THEN dls=0
  4047.         lynes.2=STRIP(DELWORD(lynes.2,7,1)) dls+1
  4048.         finfo=STATEF(notename)
  4049.         IF WORDS(finfo)>7 THEN finfo=SUBSTR(finfo,WORDINDEX(finfo,8))
  4050.         ELSE finfo=''
  4051.         CALL DELETE(notename)
  4052.         CALL savelines(notename)
  4053.         CALL DELAY(28)
  4054.         IF finfo~='' THEN ADDRESS COMMAND 'C:filenote' notename finfo
  4055.         IF WORD(data.16,1)<WORD(lynes.1,2) THEN
  4056.           DO
  4057.             lastbrowse=WORD(lynes.1,2)
  4058.             newfilesdate=DATE('S') TIME()
  4059.           END
  4060.       END
  4061.     LEAVE dloadloop
  4062.   END
  4063. END
  4064. CALL setdir(curdir)
  4065. IF errorflag THEN SAY pen3'*** Download Failed!'def||CR
  4066. IF sleepy='LOGOFF' THEN
  4067.   DO
  4068.     SAY CR
  4069.     SAY 'Logging'pen3 'OFF' def'in 10 seconds...'CR
  4070.     SAY 'Press'pen3 RETURN def'to return to'pen3 bbsname||def||CR
  4071.     SAY CR
  4072.     Timeout 10
  4073.     WAIT '?'
  4074.     IF RC~=0 THEN SIGNAL LOGOUT2
  4075.     Timeout maxidle
  4076.   END
  4077. RETURN errorflag
  4078.  
  4079.  
  4080. lastslash:
  4081. PARSE ARG sarg 
  4082. sdir=''
  4083. slash=LASTPOS('/',sarg)
  4084. IF slash>2 THEN sdir=LEFT(sarg,slash-1)
  4085. ELSE
  4086.   DO
  4087.     slash=LASTPOS(':',sarg)
  4088.     IF slash>0 THEN sdir=LEFT(sarg,slash)
  4089.   END
  4090. IF slash>0 THEN sarg=SUBSTR(sarg,slash+1)
  4091. RETURN sarg sdir
  4092.  
  4093.  
  4094. editnote:
  4095. IF arg='' THEN
  4096.   DO
  4097.     PARSE PULL arg .
  4098.     IF arg='' THEN RETURN 0
  4099.   END
  4100. comment=''
  4101. IF ~EXISTS(arg) THEN
  4102.   DO
  4103.     finfo=STATEF(bbspath'FileNotes/'plaindir'/'arg)
  4104.     temp=''
  4105.     IF WORDS(finfo)>7 THEN comment=WORD(finfo,8)
  4106.     ELSE
  4107.       DO
  4108.         IF level<sysoplevel THEN RETURN 0
  4109.         temp=getinput(1 1 'Is this file on an another device? (Nqy)')
  4110.       END
  4111.     IF temp='Y' THEN
  4112.       DO WHILE comment=''
  4113.         OPTIONS PROMPT 'Enter linkfile using full dev:path/filename > '
  4114.         PARSE PULL comment 
  4115.         comment=STRIP(comment)
  4116.         IF comment='' THEN RETURN 0
  4117.         IF ~EXISTS(comment) THEN comment=''
  4118.       END
  4119.     ELSE IF temp='Q' THEN RETURN 0
  4120.   END
  4121. IF comment='' THEN
  4122.   DO
  4123.     arg=findfiles(arg)
  4124.     IF arg=0 THEN RETURN 0
  4125.     IF DATATYPE(arg,'W') THEN arg=WORD(files.arg,2)
  4126.   END
  4127. filedir=plaindir
  4128. CALL MAKEDIR(bbspath'FileNotes/'filedir)
  4129. IF ~EXISTS(bbspath'FileNotes/'filedir) THEN
  4130.   DO
  4131.     SAY pen3'*** Failed to open directory!' filedir||def||CR
  4132.     RETURN 0
  4133.   END
  4134. notename=bbspath'FileNotes/'filedir'/'arg
  4135. lynes.=''
  4136. filenum=countcheck(bbspath'Numbers/LastFile' 0)
  4137. IF level>sysoplevel THEN firstedit=1
  4138. ELSE firstedit=5
  4139. IF EXISTS(notename) THEN
  4140.   DO
  4141.     IF comment~='' THEN ADDRESS COMMAND 'C:filenote' notename comment
  4142.     CALL bbsED(firstedit notename)
  4143.     RETURN 0
  4144.   END
  4145. IF comment='' THEN filedata=STATEF(libpath||filedir'/'arg)
  4146. ELSE filedata=STATEF(comment)
  4147. IF filedata='' THEN
  4148.   DO
  4149.     IF comment='' THEN line=filedir'/'arg
  4150.     ELSE line=comment
  4151.     SAY line 'does not exist!'CR
  4152.     RETURN 0
  4153.   END
  4154. bytes=WORD(filedata,2)
  4155. filenum=filenum+1
  4156. lynes.0=4
  4157. lynes.1='File: 'LEFT(filenum,5)' KeyWords:'
  4158. lynes.2='Name: 'LEFT(arg,27)' Size: 'bytes' bytes   Downloads: 0'
  4159. lynes.3='From: 'LEFT(name,27)' Date: 'DATE() TIME('C')'  Lib: 'filedir
  4160. lynes.4=INSERT('','',1,74,'=')
  4161. lynes.1=lynes.1 edkeywords(arg filedir)
  4162. CALL seelines(1)
  4163. edtype=''
  4164. CALL writebuffer(scratch'/NoteFile')
  4165. IF savelines(notename) THEN RETURN 0
  4166. IF comment~='' THEN ADDRESS COMMAND 'C:filenote' notename comment
  4167. fncom='R'
  4168. DO WHILE fncom='R'
  4169.   CALL seelines(1)
  4170.   nonstop=0
  4171.   line='['pen3'E'def']dit'
  4172.   IF level>sysoplevel THEN line=line '['pen3'K'def']ill'
  4173.   line=line '['pen3'R'def']ead ['pen3'S'def']ave'
  4174.   IF level>sysoplevel THEN line=line '(ekrS) 'def
  4175.   ELSE line=line '(erS) 'def
  4176.   fncom=getinput(1 1 line)
  4177.   IF fncom='K' & level>sysoplevel THEN
  4178.     DO
  4179.       SAY 'Killing FileNote..'CR
  4180.       CALL DELETE(notename)
  4181.       RETURN 1
  4182.     END
  4183.   ELSE IF fncom='E' THEN
  4184.     DO
  4185.       IF bbsED(firstedit notename)>0 THEN RETURN 0
  4186.       fncom='R'
  4187.     END
  4188.   ELSE IF fncom~='R' THEN
  4189.     DO
  4190.       SAY 'Adjusting filelist...'CR
  4191.       IF filenum<1 THEN filenum=1
  4192.       IF SHOW('P','BBBBS_LOCAL') THEN CALL SETCLIP('BBS_mainfiles',1)
  4193.       CALL countcheck(bbspath'Numbers/LastFile' filenum)
  4194.       files.0=files.0+1
  4195.       newcount=alpha.0+1
  4196.       alpha.0=newcount
  4197.       files.filenum=plaindir arg
  4198.       files.filenum.0=newcount
  4199.       libnum=finddirnum(plaindir)
  4200.       PARSE VAR lynes.1 . 'KeyWords:' keywords
  4201.       alpha.newcount=LEFT(arg,22-LENGTH(WORD(lynes.2,4)))
  4202.       alpha.newcount=alpha.newcount WORD(lynes.2,4) RIGHT(filenum,5)
  4203.       alpha.newcount=alpha.newcount RIGHT(libnum,2) LEFT(plaindir,12)
  4204.       alpha.newcount=alpha.newcount STRIP(LEFT(STRIP(keywords),32))
  4205.       IF EXISTS(bbspath'Lists/Files') THEN
  4206.         x=OPEN(f,bbspath'Lists/Files','A')
  4207.       ELSE x=OPEN(f,bbspath'Lists/Files','W')
  4208.       IF x=0 THEN
  4209.         DO
  4210.           SAY '*** Failed to open' bbspath'Lists/Files'CR
  4211.           RETURN 0
  4212.         END
  4213.       CALL WRITELN(f,filenum files.filenum)
  4214.       CALL CLOSE(f)
  4215.       IF EXISTS(bbspath'Lists/Files.ALPHA') THEN
  4216.         x=OPEN(f,bbspath'Lists/Files.ALPHA','A')
  4217.       ELSE x=OPEN(f,bbspath'Lists/Files.ALPHA','W')
  4218.       IF x=0 THEN
  4219.         DO
  4220.           SAY '*** Failed to open' bbspath'Lists/Files.ALPHA'CR
  4221.           RETURN 0
  4222.         END
  4223.       CALL WRITELN(f,alpha.newcount)
  4224.       CALL CLOSE(f)
  4225.       sortalphaflag=1
  4226.       savefileflag=1
  4227.       CALL cleanline(1)
  4228.     END
  4229. END
  4230. RETURN 0
  4231.  
  4232.  
  4233. edkeywords:
  4234. PARSE ARG kwarg
  4235. SAY CR
  4236. SAY pen3'Please enter a list of keywords (or a condensed description)'def||CR
  4237. SAY pen3'to be used in the alphabetic list and by the search routine.'def||CR
  4238. SAY '    Note that only the first 31 characters will be used.'CR
  4239. SAY INSERT('','',1,74,'=')||CR
  4240. templine=getinput(0 0 ' 'RIGHT(STRIP(RIGHT(kwarg,32)),32) pen3'KeyWords: 'def)
  4241. templine=cleanstring('0:'templine)
  4242. SAY CR
  4243. RETURN STRIP(LEFT(templine,32))
  4244.  
  4245.  
  4246. loadfiles:
  4247. SAY def||CR
  4248. SAY 'Loading filelist...'CR
  4249. files.=''
  4250. files.0=0
  4251. IF readopen(bbspath'Lists/Files') THEN
  4252.   DO
  4253.     DO i=1
  4254.       line=READLN(f)
  4255.       IF EOF(f) THEN BREAK
  4256.       num=WORD(line,1)
  4257.       IF DATATYPE(num,'W') THEN files.num=WORD(line,2) WORD(line,3)
  4258.     END
  4259.     files.0=i-1
  4260.     CALL CLOSE(f)
  4261.   END
  4262. RETURN
  4263.  
  4264.  
  4265. savefilelist:
  4266. IF level=99 THEN
  4267.   IF getinput(1 1 'Update filelists now? (nY) > ')='N' THEN RETURN
  4268.  
  4269. savefilelist2:
  4270. SIGNAL OFF BREAK_E
  4271. IF ckmaint('FILES') THEN RETURN
  4272. CALL savealphalist()
  4273. SAY 'Saving filelist...'CR
  4274. CALL SETCLIP('BBS_maint',1)
  4275. xarg=bbspath'Lists/Files'
  4276. CALL DELETE(xarg)
  4277. filenum=countcheck(bbspath'Numbers/LastFile' 0)
  4278. IF filenum<1 | writeopen(xarg)=0 THEN RETURN
  4279. DO i=1 TO filenum
  4280.   IF files.i='' THEN ITERATE i
  4281.   CALL WRITELN(f,i files.i)
  4282. END
  4283. CALL CLOSE(f)
  4284. CALL SETCLIP('BBS_maint')
  4285. savefileflag=0
  4286. IF SHOW('P','BBBBS_LOCAL') THEN CALL SETCLIP('BBS_mainfiles',2)
  4287. RETURN
  4288.  
  4289.  
  4290. loadalpha:
  4291. SAY def||CR
  4292. SAY 'Loading the alphabetical filelist...'CR
  4293. IF readopen(bbspath'Lists/Files.ALPHA') THEN
  4294.   DO
  4295.     alpha.=''
  4296.     alpha.0=0
  4297.     DO i=1
  4298.       line=READLN(f)
  4299.       IF EOF(f) THEN BREAK
  4300.       fnum=WORD(line,3)
  4301.       IF DATATYPE(fnum,'W') THEN
  4302.         DO
  4303.           alpha.i=line
  4304.           files.fnum.0=i
  4305.         END
  4306.       ELSE i=i-1
  4307.     END
  4308.     CALL CLOSE(f)
  4309.     alpha.0=i-1
  4310.     IF alpha.0<files.0 THEN buildalpha=1
  4311.   END
  4312. ELSE SAY pen3'*** Lists/Files.ALPHA failed to open for reading!'def||CR
  4313. SAY CR
  4314. RETURN
  4315.  
  4316.  
  4317. ckmaint:
  4318. ARG ckfile .
  4319. IF GETCLIP('BBS_maint')~='' THEN
  4320.   DO
  4321.     DO i=0 TO 23 WHILE GETCLIP('BBS_maint')~=''
  4322.       IF i//2=0 THEN SAY 'Waiting' (24-i)*5 'more seconds for' ckfile 'list update to finish...'CR
  4323.       CALL DELAY(250)
  4324.     END
  4325.     IF i>23 THEN
  4326.       DO
  4327.         line='*** unable to update' ckfile 'list.'
  4328.         CALL send2log(line DATE() TIME('C'))
  4329.         SAY line||CR
  4330.         RETURN 1
  4331.       END
  4332.   END
  4333. RETURN 0
  4334.  
  4335.  
  4336. savealphalist:
  4337. SIGNAL OFF BREAK_E
  4338. IF ckmaint('ALPHA') THEN RETURN
  4339. CALL SETCLIP('BBS_maint',1)
  4340. IF GETCLIP('BBS_localfiles')~='' THEN
  4341.   DO
  4342.     CALL SETCLIP('BBS_localfiles')
  4343.     CALL loadfiles()
  4344.     CALL loadalpha()
  4345.   END
  4346. aarg=bbspath'Lists/Files.ALPHA'
  4347. CALL DELETE(aarg)
  4348. IF sortalphaflag=1 THEN
  4349.   DO
  4350.     SAY 'Alphabetizing' alpha.0 'files...'CR
  4351.     CALL QSORT(1,alpha.0,alpha)
  4352.     DO i=1 TO alpha.0
  4353.       fnum=WORD(alpha.i,3)
  4354.       files.fnum.0=i
  4355.     END
  4356.   END
  4357. sortalphaflag=0
  4358. IF writeopen(aarg)=0 THEN
  4359.   DO
  4360.     SAY '*** Error opening' aarg '!'CR
  4361.     RETURN
  4362.   END
  4363. SAY 'Saving alphabetical filelist...'CR
  4364. DO i=1 TO alpha.0
  4365.   ii=WORD(alpha.i,3)
  4366.   IF files.ii='' THEN alpha.i='0 0' ii '100'
  4367.   IF LEFT(alpha.i,4)~='0 0 ' THEN CALL WRITELN(f,alpha.i)
  4368. END
  4369. CALL CLOSE(f)
  4370. CALL SETCLIP('BBS_maint')
  4371. ADDRESS AREXX bbsALPHA.rexx SUBSTR(extension,2) arccom
  4372. RETURN
  4373.  
  4374.  
  4375. viewuser:
  4376. SAY CR
  4377. SAY bak2' 'name' 'def||CR
  4378. DO i=1 TO 18
  4379.   stuff=data.i
  4380.   IF i=13 | i=14 THEN stuff=DATE(,data.i,'S')
  4381.   SAY RIGHT(i,2)||pen3 text.i||def':' stuff||CR
  4382. END
  4383. CALL waiting()
  4384. RETURN
  4385.  
  4386.  
  4387. edituser:
  4388. IF getinput(1 1 'Change ['pen3'U'def']ser data or ['pen3'M'def']essage conference access (mU) > ')='M' THEN
  4389.   DO
  4390.     SAY CR
  4391.     SAY pen3'     - Message Conference Access -'def||CR
  4392.     SAY '[O]ff turns all message conferences OFF.'CR
  4393.     SAY 'Set the last message read by you in ALL message conferences'CR
  4394.     temp=getinput(1 1 ' ['pen3'L'def']ast  ['pen3'F'def']irst  ['pen3'O'def']ff  ['pen3'Q'def']uit  (fLoq) > ')
  4395.     IF temp='Q' THEN RETURN
  4396.     SAY 'Resetting...'lineup||CR
  4397.     data.22=''
  4398.     DO i=1 TO level
  4399.       IF temp='F' THEN num=0
  4400.       ELSE IF temp='O' THEN num=-1
  4401.       ELSE num=countcheck(bbspath'Numbers/LastMessage'i 0)
  4402.       data.22=data.22 num
  4403.     END
  4404.     CALL SetData()
  4405.     CALL sortconferences()
  4406.     CALL savedata(1)
  4407.     RETURN
  4408.   END
  4409. new=0
  4410. change=0
  4411. edata.=''
  4412. edname=name
  4413. DO i=0 TO data.0
  4414.   edata.i=data.i
  4415. END
  4416. num=1
  4417. DO WHILE num~='' | edname~=name
  4418.   IF num='' THEN
  4419.     DO
  4420.       IF change THEN
  4421.         DO
  4422.           CALL SetData()
  4423.           CALL saveData(1)
  4424.           change=0
  4425.         END
  4426.       IF new THEN
  4427.         DO
  4428.           data.=''
  4429.           DO i=0 TO edata.0
  4430.             data.i=edata.i
  4431.           END
  4432.           name=edname
  4433.           new=0
  4434.         END
  4435.       CALL SetData()
  4436.     END
  4437.   maxnum=10
  4438.   IF edata.20>sysoplevel THEN maxnum=20
  4439.   IF edata.20=99 THEN maxnum=24
  4440.   SAY bak2' 'name' 'def||CR
  4441.   maxlines=21
  4442.   IF maxnum=10 THEN maxlines=20
  4443.   DO i=1 TO maxlines
  4444.     IF i=5 & name~=edname & edata.20<99 THEN ITERATE
  4445.     SAY RIGHT(i,2)||pen3 text.i||def':' data.i||CR
  4446.   END
  4447.   IF edata.20>sysoplevel THEN
  4448.     DO
  4449.       line=LEFT(' ',50)
  4450.       IF name=edname THEN line=line'NEW = Change User.'
  4451.       line=pen3||line||def||lineup
  4452.       SAY line||CR
  4453.     END
  4454.   num=getinput(1 0 'Select Line Number To Edit: ')
  4455.   IF num='NEW' & edata.20>sysoplevel & edname=name THEN    /* select a new user */
  4456.     DO
  4457.       new=1
  4458.       IF change THEN
  4459.         DO
  4460.           CALL SetData()
  4461.           CALL saveData(1)
  4462.         END
  4463.       change=0
  4464.       nufile=bbspath'Lists/NEW_USERS'
  4465.       IF EXISTS(nufile) THEN
  4466.         IF ~readlines(nufile 1) THEN CALL seelines(0)
  4467.       savename=name
  4468.       name=getinput(1 0 'New User Name: 'def)
  4469.       name=cleanstring(1':'name)
  4470.       IF loadData()=0 THEN name=savename
  4471.       IF data.20>=edata.20 THEN
  4472.         DO
  4473.           SAY 'Can''t Edit!' pen3||name def'has an equal or higher level than thee.'
  4474.           name=savename
  4475.           CALL loadData()
  4476.         END
  4477.     END
  4478.   ELSE IF DATATYPE(num,'W') & num>0 THEN
  4479.     DO
  4480.       IF num>maxnum THEN
  4481.         DO
  4482.           SAY CR
  4483.           SAY pen3'You are not authorized to change that information!'def||CR
  4484.           SAY CR
  4485.         END
  4486.       ELSE
  4487.         DO dummy=1 TO 1
  4488.           IF num=8 THEN
  4489.             DO
  4490.               SAY CR
  4491.               SAY 'Use spaces to separate options.'CR
  4492.               SAY 'If the option word is in line 8, it is ON.'CR
  4493.               SAY 'Valid Options:'CR
  4494.               SAY '        COLOR  turns ANSI color codes ON.'CR
  4495.               SAY '        MENU   combines all main commands into 1 menu.'CR
  4496.               SAY '        MENUS  splits main commands into 3 menus.'CR
  4497.               SAY '        PHONE  makes your phone number public.'CR
  4498.               SAY '        QUICK  activates offline options. See bbsQUICK.DOC'CR
  4499.               SAY '        STREET makes your street address public.'CR
  4500.               SAY '        TERSE  skips some of the logon procedures.'CR
  4501.               SAY CR
  4502.             END
  4503.           line=RIGHT(num,2)||pen3 text.num||def': '
  4504.           SAY line||data.num||CR
  4505.           temp=getinput(0 0 line)
  4506.           IF temp='' THEN
  4507.             DO
  4508.               IF num=1 | num=4 | num=5 | num=6 | num=7 THEN LEAVE dummy
  4509.               IF num=11 | num=12 | num=13 | num=20 THEN LEAVE dummy
  4510.             END
  4511.           IF num=5 | num=8 THEN temp=UPPER(temp)
  4512.           IF num=20 & DATATYPE(temp,'W') & temp>=edata.20 THEN
  4513.             temp=data.20
  4514.           IF edata.20>sysoplevel & name~=edname THEN line2=name' '
  4515.           ELSE line2=''
  4516.           IF num=21 & name=edname & edata.20<99 THEN LEAVE dummy
  4517.           line=text.num':' data.num pen6'CHANGED TO'def temp
  4518.           CALL send2log(line2||line)
  4519.           data.num=temp
  4520.           SAY line||CR
  4521.           SAY CR
  4522.           change=1
  4523.         END
  4524.     END
  4525. END
  4526. IF change THEN
  4527.   DO
  4528.     CALL SetData()
  4529.     CALL saveData(1)
  4530.   END
  4531. RETURN
  4532.  
  4533.  
  4534. getnumber:
  4535. PARSE ARG tprompt
  4536. tnum=getinput(1 0 '  'tprompt' > ')
  4537. mask=COMPRESS(XRANGE(),'0123456789')
  4538. tnum=COMPRESS(tnum,mask)
  4539. IF ~DATATYPE(tnum,'W') THEN tnum=0
  4540. tnum=tnum%1
  4541. IF tnum>0 & tnum<10 THEN tnum='0'tnum
  4542. RETURN tnum
  4543.  
  4544.  
  4545. getbirth:
  4546. data.12=WORD(data.12,1)'  'WORD(data.12,2)'  Birthday:'
  4547. SAY pen3'Please enter your birthday.'def||CR
  4548. month=getnumber('month: (1-12)')
  4549. day=getnumber('  day: (1-31)')
  4550. year=getnumber(' year:       ')
  4551. IF year<100 THEN year=year+1900
  4552. born=year||month||day
  4553. IF born<18750101 | born>(DATE('S')-50000) THEN   /* must be older than 4 */
  4554.   DO
  4555.     born=''
  4556.     IF getinput(1 1 'Would you rather skip this question? (Ny) > ')~='Y' THEN
  4557.       CALL getbirth()
  4558.   END
  4559. data.12=WORD(data.12,1)'  'WORD(data.12,2)'  'WORD(data.12,3)' 'WORD(born,1)
  4560. RETURN
  4561.  
  4562.  
  4563. getname:
  4564. CALL showuserlist()
  4565. SAY CR
  4566. pline='Please enter your full Email name : '
  4567. name=getinput(1 0 pline)
  4568. IF name='' THEN
  4569.   DO
  4570.     name=getinput(1 0 pline)
  4571.     IF name='' THEN
  4572.       DO
  4573.         SAY 'No name, no entry.  Bye!'CR
  4574.         SIGNAL DONE
  4575.       END
  4576.   END
  4577. name=cleanstring(1':'name)
  4578. IF FIND(userlist,name)>0 | FIND(exclusion,name)>0 THEN
  4579.   DO
  4580.     SAY 'Sorry! That name is taken. Please try again.'CR
  4581.     RETURN 1
  4582.   END
  4583. RETURN 0
  4584.  
  4585.  
  4586. /** see if name is in data */
  4587.  
  4588. checkUser:
  4589. tries=0
  4590. IF name='NEW' THEN
  4591.   DO
  4592.     name=''
  4593.     DO WHILE getname()
  4594.     END
  4595.     CALL postuser(7)
  4596.   END
  4597. IF FIND(userlist,name)=0 THEN
  4598.   DO
  4599.     IF EXISTS(bbspath'BBS_TEXT/NEW') THEN
  4600.       DO
  4601.         nonstop=0
  4602.         CALL readlines(bbspath'BBS_TEXT/NEW' 1)
  4603.         CALL seelines(0)
  4604.         CALL waiting()
  4605.       END
  4606.     SAY CR
  4607.     IF getinput(1 1 'Do you want to register? (nY) > ')='N' THEN
  4608.       DO
  4609.         SAY 'Thanks anyway, bye!'CR
  4610.         line=name 'did not want to register.'
  4611.         SIGNAL OUT2
  4612.       END
  4613.     defile=bbspath'BBS_TEXT/DEF.NEW_USER'
  4614.     CALL loadcourtesy()
  4615.     wordnum=FIND(courtesy,name)
  4616.     IF wordnum>0 THEN
  4617.       DO
  4618.         SAY name', is on the Courtesy List. You will be granted immediate access.'CR
  4619.         courtesy=STRIP(DELWORD(courtesy,wordnum,1))
  4620.         IF writeopen(bbspath'Lists/Courtesy') THEN
  4621.           DO
  4622.             DO i=1 TO WORDS(courtesy)
  4623.               CALL WRITELN(f,WORD(courtesy,i))
  4624.             END
  4625.             CALL CLOSE(f)
  4626.           END
  4627.         defile=bbspath'BBS_TEXT/DEF.COURTESY'
  4628.       END
  4629.     ELSE IF bbsprefs.7=0 THEN SAY name', You have new user access.'CR
  4630.     IF readlines(defile 1) THEN SIGNAL DONE
  4631.     CALL sound('NEW_USER')
  4632.     data.=''
  4633.     data.0=24
  4634.     DO i=6 TO 22
  4635.       data.i=lynes.i
  4636.     END
  4637.     data.12=DATE('S')'  'TIME('C')
  4638.     data.13=data.12
  4639.     lastondate=DATE('I')-1
  4640.     lastontime=TIME('C')
  4641.     x=FIND(UPPER(data.8),'COLOR')
  4642.     test=getinput(1 1 'Does your terminal handle' pen3'ANSI color'def 'codes? (nY) > ')
  4643.     IF test='N' THEN
  4644.       DO
  4645.         IF x>0 THEN data.8=DELWORD(data.8,x,1)
  4646.         CALL colors(0)
  4647.       END
  4648.     ELSE IF x=0 THEN
  4649.       DO
  4650.         data.8=data.8 'COLOR'
  4651.         CALL colors(1)
  4652.       END
  4653.     SAY 'Please enter the password you would like to use here.'CR
  4654.     data.5=getinput(1 0 'Password: ')
  4655.     IF data.5='' THEN
  4656.       DO
  4657.         line=''name 'refused to enter a password.'
  4658.         SIGNAL DONE
  4659.       END
  4660.     data.1=''
  4661.     DO WHILE data.1=''
  4662.       data.1=getinput(0 0 'Full Name: ')
  4663.       IF data.1='' THEN SAY 'You MUST leave your real name!'CR
  4664.     END
  4665.     data.2=getinput(0 0 'Street: ')
  4666.     data.3=getinput(0 0 'City, State Zip: ')
  4667.     data.4=''
  4668.     DO WHILE data.4=''
  4669.       data.4=getinput(0 0 'Phone: ')
  4670.       IF data.4='' THEN
  4671.         SAY sysop 'MUST be able to reach you by phone to validate you!'CR
  4672.     END
  4673.     CALL getbirth()
  4674.     IF bbsprefs.8 THEN
  4675.       DO
  4676.         newufile=bbspath'Lists/NEW_USERS'
  4677.         IF EXISTS(newufile) THEN ok=OPEN(f,newufile,'A')
  4678.         ELSE
  4679.           DO
  4680.             ok=OPEN(f,newufile,'W')
  4681.             IF ok~=0 THEN CALL WRITELN(f,'*** New Users ***')
  4682.           END
  4683.         IF ok~=0 THEN CALL WRITELN(f,DATE() TIME() name' = 'data.1'   'data.4)
  4684.         CALL CLOSE(f)
  4685.       END
  4686.     data.9=getinput(0 0 'Computer: ')
  4687.     data.10=getinput(0 0 'Interests: ')
  4688.     test=getinput(1 1 pen3'Do you want other users to see your STREET address? (Ny) > 'def)
  4689.     IF test='Y' THEN data.8=data.8 'STREET'
  4690.     test=getinput(1 1 pen3'Do you want other users to see your PHONE number? (Ny) > 'def)
  4691.     IF test='Y' THEN data.8=data.8 'PHONE'
  4692.     IF bbsprefs.7>0 THEN
  4693.       DO
  4694.         data.20=bbsprefs.7
  4695.         data.11='60 minutes' bbsprefs.16-1 'more times today'
  4696.       END
  4697.     SAY CR
  4698.     IF data.20=0 THEN
  4699.       SAY 'Thank you, the sysop will give you higher access soon.'CR
  4700.     SAY 'Please feel free to leave additional info by using [C]omment.'CR
  4701.     SAY CR
  4702.     CALL SetData()
  4703.     CALL saveData(1)
  4704.     SAY 'Adding' name 'to the user list...'CR
  4705.     newpassword=data.5
  4706.     sortuserflag=1
  4707.     temp=countcheck(bbspath'Numbers/Users' 0)+1
  4708.     CALL countcheck(bbspath'Numbers/Users' temp)
  4709.     CALL DELETE(bbspath'Lists/USERS')
  4710.   END
  4711. ELSE
  4712.   DO
  4713.     IF loadData()=0 THEN SIGNAL DONE
  4714.     PARSE VAR data.11 amins . atimes .
  4715.     lastondate=DATE('I',WORD(data.13,1),'S')
  4716.     lastontime=WORD(data.13,2)
  4717.     IF DATE('I')>lastondate | level>=sysoplevel THEN atimes=bbsprefs.16
  4718.     IF level=99 THEN amins=120
  4719.     data.13=DATE('S')'  'TIME()
  4720.     data.11=amins 'minutes' atimes-1 'more times today'
  4721.     IF atimes<1 & DATE('I')=lastondate THEN
  4722.       DO
  4723.         SAY CR
  4724.         SAY CR
  4725.         line= 'Too many calls today.   Call tomorrow.'
  4726.         SAY line||CR
  4727.         SAY CR
  4728.         SAY CR
  4729.         CALL send2log(line)
  4730.         SIGNAL LOGOUT
  4731.       END
  4732.     data.13=DATE('S')'  'TIME('C')
  4733.     SAY pen3'Password will'def 'NOT' pen3'be echoed.'def||CR
  4734.     SAY CR
  4735.     passprompt='Enter Password: '
  4736.     DO tries=1 TO 3
  4737.       Send passprompt
  4738.       Remote OFF
  4739.       OPTIONS PROMPT ''
  4740.       newpassword=getinput(1 0 '')
  4741.       Remote ON
  4742.       IF(password=newpassword) THEN
  4743.         DO
  4744.           SAY ''CR
  4745.           LEAVE tries; /* correct password */
  4746.         END
  4747.       IF tries=3 THEN
  4748.         DO             /* 3 tries, hang up */
  4749.           SAY ''CR
  4750.           SAY 'Access terminated.'CR
  4751.           line='*** Bad password ***' newpassword '***'
  4752.           SAY line||CR
  4753.           city=line
  4754.           CALL postuser(6)
  4755.           SIGNAL OUT2
  4756.         END
  4757.       SAY ''lineup'                                 'CR
  4758.       passprompt='Incorrect.  Password: ' /* ask again */
  4759.     END
  4760.   END
  4761. SAY CR
  4762.  
  4763. /* Uncomment section below to have name announced at logon. */
  4764. /*
  4765. IF SHOWLIST('H','SPEAK') THEN
  4766.   DO
  4767.     IF writeopen('SPEAK:')~=0 THEN
  4768.       DO
  4769.         CALL WRITELN(f,'Yo sissop.')
  4770.         CALL WRITELN(f,name 'has logd awn.')
  4771.         CALL CLOSE(f)
  4772.       END
  4773.   END
  4774. ELSE IF EXISTS(saypath) THEN
  4775.   DO
  4776.     ADDRESS COMMAND saypath 'Yo sissop.'
  4777.     ADDRESS COMMAND saypath name 'logd awn.'
  4778.   END
  4779. */
  4780. RETURN
  4781.  
  4782.  
  4783. saveData:
  4784. ARG messflag .
  4785. IF data.5='' THEN RETURN
  4786. temp=GETCLIP(name'_UPDATE')
  4787. IF temp~='' THEN
  4788.   DO
  4789.     CALL SETCLIP(name'_UPDATE')
  4790.     PARSE VAR temp upfiles' 'upbytes' 'upmail' 'upmsg
  4791.     IF upfiles>0 THEN
  4792.       DO
  4793.         files=WORD(data.14,1)
  4794.         bytes=WORD(data.14,3)
  4795.         IF DATATYPE(files,'W') THEN upfiles=upfiles+files
  4796.         IF DATATYPE(bytes,'W') THEN bytes=upbytes
  4797.         data.14=upfiles 'files' bytes 'bytes.' DATE()
  4798.       END
  4799.     IF upmail>0 THEN
  4800.       DO
  4801.         mail=WORD(data.17,2)
  4802.         IF DATATYPE(mail,'W') THEN upmail=upmail+mail
  4803.         data.17=WORD(data.17,1) upmail WORD(data.17,3)
  4804.       END
  4805.     IF upmsg~='' THEN
  4806.       DO
  4807.         temp=data.23
  4808.         DO i=1 TO level
  4809.           msg=WORD(temp,i)
  4810.           IF ~DATATYPE(msg,'W') THEN msg=0
  4811.           IF FIND(upmsg,i) THEN msg=msg+1
  4812.           data.23=data.23 msg
  4813.         END
  4814.       END
  4815.   END
  4816. SAY 'Updating...             'lineup||CR
  4817. SIGNAL OFF BREAK_E
  4818. Status Trans
  4819. data.6=STRIP(RESULT)
  4820. IF newfilesdate~='' THEN data.16=lastbrowse newfilesdate
  4821. ELSE IF lastbrowse>0 THEN
  4822.   DO
  4823.     IF WORDS(data.16)>1 THEN data.16=DELWORD(data.16,1,1)
  4824.     ELSE data.16=DATE('S') TIME()
  4825.     data.16=lastbrowse data.16
  4826.   END
  4827. IF messflag THEN
  4828.   DO
  4829.     userexclude.=0
  4830.     DO si=1 TO WORDS(data.22)
  4831.       IF WORD(data.22,si)=-1 THEN userexclude.si=1
  4832.     END
  4833.     data.22=''
  4834.     data.23=''
  4835.     DO si=1 TO level
  4836.       IF ~DATATYPE(lastread.si,'W') THEN lastread.si=0
  4837.       IF userexclude.si THEN data.22=data.22 '-1'
  4838.       ELSE data.22=data.22 lastread.si
  4839.       IF ~DATATYPE(totwrit.si,'W') THEN totwrit.si=0
  4840.       data.23=data.23 totwrit.si
  4841.     END
  4842.   END
  4843. IF writeopen(bbspath'USERS/'name)=0 THEN RETURN
  4844. IF data.0<26 THEN data.0=26
  4845. DO i=1 TO data.0
  4846.   CALL WRITELN(f,data.i)
  4847. END
  4848. CALL CLOSE(f)
  4849. SAY 'User' name 'has been updated.'CR
  4850. RETURN
  4851.  
  4852.  
  4853. loadData:
  4854. IF name='' THEN RETURN 0
  4855. IF ~readopen(bbspath'USERS/'name) THEN RETURN 0
  4856. data.=''
  4857. DO i=1
  4858.   line=READLN(f)
  4859.   IF EOF(f) THEN BREAK
  4860.   data.i=line
  4861. END
  4862. data.0=i-1
  4863. CALL CLOSE(f)
  4864. winnings=WORD(data.18,1)
  4865. IF ~DATATYPE(winnings,'N') THEN winnings=0
  4866.  
  4867. setData:
  4868. IF WORDS(data.16)<3 THEN data.16='0 19900101 00:00:00'
  4869. lastbrowse=WORD(data.16,1)
  4870. IF ~DATATYPE(lastbrowse,'W') THEN lastbrowse=0
  4871. level=data.20
  4872. DO i=1 TO level
  4873.   lastread.i=WORD(data.22,i)
  4874.   IF ~DATATYPE(lastread.i,'W') THEN lastread.i=0
  4875.   totwrit.i=WORD(data.23,i)
  4876.   IF ~DATATYPE(totwrit.i,'W') THEN totwrit.i=0
  4877. END
  4878. password=data.5
  4879. IF data.6='' THEN
  4880.   DO
  4881.     Status Trans
  4882.     data.6=RESULT
  4883.   END
  4884. ELSE
  4885.   DO
  4886.     IF RIGHT(UPPER(data.6),2)='-G' THEN data.6='G'
  4887.     IF RIGHT(UPPER(data.6),3)='-1K' THEN data.6='K'
  4888.     IF LEFT(UPPER(data.6),1)='A' THEN data.6='Z'
  4889.     Set UPPER(LEFT(data.6,1))
  4890.   END
  4891. IF ~DATATYPE(data.7,'W') THEN data.7=20
  4892. IF data.7<5 THEN data.7=5
  4893. linesperpage=data.7
  4894. IF FIND(UPPER(data.8),'TERSE')>0 THEN terseflag=1
  4895. ELSE terseflag=0
  4896. IF FIND(UPPER(data.8),'COLOR')>0 THEN colorflag=1
  4897. ELSE colorflag=0
  4898. CALL colors(colorflag)
  4899. menu='ALL'
  4900. IF FIND(UPPER(data.8),'MENUS')>0 THEN
  4901.   DO
  4902.     menuflag=1
  4903.     menu='MAIN'
  4904.   END
  4905. ELSE IF FIND(UPPER(data.8),'MENU')>0 THEN menuflag=1
  4906. ELSE menuflag=0
  4907. IF level=0 THEN menu='NEW'
  4908. data.21=UPPER(data.21)
  4909. maxtime=WORD(data.11,1)*60
  4910. RETURN 1
  4911.  
  4912.  
  4913. switchmenuflag:
  4914. IF menuflag=1 THEN
  4915.   DO
  4916.     menuflag=0
  4917.     noff='OFF'
  4918.   END
  4919. ELSE
  4920.   DO
  4921.     menuflag=1
  4922.     noff='ON'
  4923.   END
  4924. SAY 'Menus turned' pen3||noff||def'.'CR
  4925. SAY 'To make a permanent change, add or delete MENU(S) from [Y]our userdata item 8.'CR
  4926. RETURN
  4927.  
  4928.  
  4929. switchcolors:
  4930. IF colorflag=1 THEN
  4931.   DO
  4932.     colorflag=0
  4933.     noff='OFF'
  4934.   END
  4935. ELSE
  4936.   DO
  4937.     colorflag=1
  4938.     noff='ON'
  4939.   END
  4940. CALL colors(colorflag)
  4941. SAY 'Color turned' pen3||noff||def'.'CR
  4942. SAY 'To make a permanent change, add or delete COLOR from [Y]our userdata item 8.'CR
  4943. RETURN
  4944.  
  4945.  
  4946. /* ANSI pen color codes */
  4947. colors:
  4948. ARG onoff
  4949. IF onoff THEN
  4950.   DO
  4951.     lineup='1B'x'M'
  4952.     def='';  /* default */
  4953.     pen0='';  pen1='';  pen2='';  pen3=''
  4954.     pen4='';  pen5='';  pen6='';  pen7=''
  4955.     bak0='';  bak1='';  bak2='';  bak3=''
  4956.     bak4='';  bak5='';  bak6='';  bak7=''
  4957.   END
  4958. ELSE
  4959.   DO
  4960.     pen0=''; pen1=''; pen2=''; pen3=''; pen4=''; pen5=''; pen6=''; pen7=''
  4961.     bak0=''; bak1=''; bak2=''; bak3=''; bak4=''; bak5=''; bak6=''; bak7=''
  4962.     def='';  lineup=''
  4963.   END
  4964. RETURN
  4965.  
  4966.  
  4967. chpro:
  4968. arg=UPPER(LEFT(arg,1))
  4969. IF(arg='') THEN
  4970.   DO
  4971.     SAY CR
  4972.     SAY '['pen3'W'def']- WXModem'CR
  4973.     SAY '['pen3'X'def']- XModem-CRC'CR
  4974.     SAY '['pen3'K'def']- XModem-1K'CR
  4975.     SAY '['pen3'Y'def']- YModem'CR
  4976.     SAY '['pen3'G'def']- YModem-G'CR
  4977.     SAY '['pen3'Z'def']- ZModem'CR
  4978. /* IF RIGHT(BB_VERS,4)>1.59 THEN SAY '['pen3'R'def']- Kermit'CR */
  4979.     SAY CR
  4980.     arg=getinput(1 0 STRIP(protocol) '> ')
  4981.  END
  4982. IF LEFT(UPPER(arg),1)='A' THEN arg='Z'
  4983. Set arg
  4984. Status Transfer
  4985. protocol=STRIP(RESULT)
  4986. SAY protocol||CR
  4987. RETURN
  4988.  
  4989.  
  4990. sortinfofiles:
  4991. infolist=SHOWDIR(bbspath'Information')
  4992. IF infolist='' THEN
  4993.   DO
  4994.     SAY CR
  4995.     SAY pen3'No files are currently in the Information drawer.'def||CR
  4996.     SAY CR
  4997.     RETURN 1
  4998.   END
  4999. IF ~DATATYPE(sortinfo.0,'W') THEN
  5000.   DO
  5001.     info.=''
  5002.     sortinfo.=''
  5003.     info.0=WORDS(infolist)
  5004.     DO i=1 TO info.0
  5005.       info.i=WORD(infolist,i)
  5006.     END
  5007.     SAY 'Sorting..'CR
  5008.     CALL QSORT(1,info.0,info)
  5009.     sortinfo.0=info.0%3
  5010.     IF (info.0//3)>0 THEN sortinfo.0=sortinfo.0+1
  5011.     DO i=1 TO sortinfo.0
  5012.       sortinfo.i=''
  5013.       DO j=0 TO 2
  5014.         k=i+j*sortinfo.0
  5015.         IF k<=info.0 THEN
  5016.           DO
  5017.             sortinfo.i=sortinfo.i RIGHT(k,3)'.' LEFT(info.k,19)
  5018.             infocount=WORD(STATEF(bbspath'Information/'info.k),8)
  5019.             sortinfo.i.0=sortinfo.i.0||RIGHT(infocount,5) LEFT(info.k,19)
  5020.           END
  5021.       END
  5022.     END
  5023.     SAY lineup'         'lineup||CR
  5024.   END
  5025. RETURN 0
  5026.  
  5027.  
  5028. information:
  5029. IF sortinfofiles() THEN RETURN
  5030. SAY pen3'These text files are available for reading online...'def||CR
  5031. num=1
  5032. readcount=-1
  5033. DO infoloop=1
  5034.   IF num=0 THEN
  5035.     DO
  5036.       IF readcount~=-1 THEN
  5037.         DO
  5038.           sortinfo.0=''
  5039.           IF sortinfofiles() THEN RETURN
  5040.         END
  5041.       SAY CENTER('- Number of accesses per file -',75)||CR
  5042.     END
  5043.   SAY pen3||LEFT('-',75,'-')||def||CR
  5044.   IF num=0 THEN
  5045.     DO i=1 TO sortinfo.0
  5046.       SAY sortinfo.i.0||CR
  5047.     END
  5048.   ELSE
  5049.     DO i=1 TO sortinfo.0
  5050.       SAY sortinfo.i||CR
  5051.     END
  5052.   CALL checktime()
  5053.   IF num=0 THEN
  5054.     DO
  5055.       CALL waiting()
  5056.       num=1
  5057.       ITERATE infoloop
  5058.     END
  5059.   num=getinput(1 0 pen3'Select Number Of Information File To View. 0=Stats > 'def)
  5060.   IF num=0 THEN ITERATE infoloop
  5061.   IF ~DATATYPE(num,'W') | num<1 | num>info.0 THEN RETURN
  5062.   readcount=STATEF(bbspath'Information/'info.num)
  5063.   readbytes=WORD(readcount,2)
  5064.   readcount=WORD(readcount,8)
  5065.   IF ~DATATYPE(readcount,'W') THEN readcount=0
  5066.   SAY '  'info.num 'is' readbytes 'bytes.'CR
  5067.   SAY 'Loading File...'CR
  5068.   ADDRESS COMMAND 'C:filenote' bbspath'Information/'info.num readcount+1
  5069.   CALL readlines(bbspath'Information/'info.num 1)
  5070.   CALL cleanline(0)
  5071.   SAY lineup'    'lynes.0 'lines.'CR
  5072.   SAY CR    
  5073.   CALL seelines(0)
  5074.   CALL showtime()
  5075.   IF waitchar~='Q' THEN CALL waiting()
  5076.   nonstop=0
  5077. END
  5078. RETURN
  5079.  
  5080.  
  5081. newfiles:
  5082. SAY CR
  5083. test=''
  5084. test=getinput(1 1 'Show one library only? (Ny) > ')
  5085. IF test='Y' THEN
  5086.   IF chdir()>0 THEN RETURN
  5087. SAY 'Searching for new (un-browsed) files since' DATE(,WORD(data.16,2),'S') 'at' WORD(data.16,3)'...'CR
  5088. lastbrowz=WORD(data.16,1)
  5089. lastfileup=countcheck(bbspath'Numbers/LastFile' 0)
  5090. IF lastbrowz>=lastfileup THEN
  5091.   DO
  5092.     lastbrowz=0
  5093.     SAY pen3'No new files. Listing backwards by date from last file uploaded...'def||CR
  5094.   END
  5095. ELSE newfilesflag=1
  5096. j=0
  5097. IF test='Y' THEN filecount=WORDS(SHOWDIR(bbspath'FileNotes/'plaindir))
  5098. DO ni=lastfileup TO lastbrowz+1 BY -1
  5099.   IF files.ni~='' THEN
  5100.     DO
  5101.       IF test='Y' THEN 
  5102.         DO
  5103.           IF j>=filecount THEN LEAVE ni
  5104.           IF UPPER(LEFT(WORD(files.ni,1),12))~=UPPER(LEFT(plaindir,12)) THEN
  5105.             ITERATE ni
  5106.         END
  5107.       jj=files.ni.0
  5108.       IF WORD(alpha.jj,4)>level | FIND(data.21,UPPER(WORD(files.ni,1)))>0 THEN
  5109.         ITERATE ni  /* unauthorized */
  5110.       j=j+1
  5111.       IF j=1 THEN CALL fileheader()
  5112.       SAY alpha.jj||CR
  5113.       IF (j+2)//(linesperpage-1)=0 THEN
  5114.         IF waiting2() THEN LEAVE ni
  5115.     END
  5116. END
  5117. IF j//linesperpage~=0 THEN CALL waiting()
  5118. IF test~='Y' THEN
  5119.   DO
  5120.     CALL newinfo()
  5121.     IF lynes.0>0 THEN CALL waiting()
  5122.   END
  5123. nonstop=0
  5124. RETURN
  5125.  
  5126.  
  5127. newinfo:
  5128. lynes.=''
  5129. lynes.0=0
  5130. dm=DATE(,WORD(data.16,2),'S')
  5131. PARSE VAR dm da' 'mo' 'yr .
  5132. yr=RIGHT(yr,2)
  5133. sincedate=da'-'mo'-'yr
  5134. startline=1
  5135. arg=bbspath'Information'
  5136. IF WORD(STATEF(arg),5)>lastondate THEN
  5137.   DO
  5138.     ADDRESS COMMAND 'C:LIST >ram:dirlist' arg 'NOHEAD DATES SINCE' sincedate
  5139.     IF WORD(STATEF('ram:dirlist'),2)>3 THEN
  5140.       DO
  5141.         lynes.startline=pen1||bak2' New or Updated Information Files. Enter'def pen3'I'def bak2'from the main menu to read 'def
  5142.         CALL readlines('ram:dirlist' startline+1)
  5143.       END
  5144.   END
  5145. arg=bbspath'Profiles'
  5146. IF level>0 & WORD(STATEF(arg),5)>lastondate THEN
  5147.   DO
  5148.     ADDRESS COMMAND 'C:LIST >ram:dirlist' arg 'NOHEAD DATES SINCE' sincedate
  5149.     IF WORD(STATEF('ram:dirlist'),2)>3 THEN
  5150.       DO
  5151.         startline=lynes.0+2
  5152.         lynes.startline=pen1||bak2' New or Updated User Profiles. Enter'def pen3'&'def bak2'from the main menu to read 'def
  5153.         CALL readlines('ram:dirlist' startline+1)
  5154.       END
  5155.   END
  5156. arg=bbspath'rexxDoors/Data/Polls'
  5157. IF level>0 & WORD(STATEF(arg),5)>lastondate THEN
  5158.   DO
  5159.     startline=lynes.0+2
  5160.     lynes.startline=pen1||bak2' Voting Activity. Enter'def pen3'J'def bak2'from the main menu, then select Polling_Place 'def
  5161.     lynes.0=startline
  5162.   END
  5163. IF logonflag=1 THEN nonstop=1
  5164. IF lynes.0>0 THEN CALL seelines(1)
  5165. nonstop=0
  5166. RETURN
  5167.  
  5168.  
  5169. areaselect:
  5170. SAY pen3||LEFT('-',75,'-')||def||CR
  5171. DO i=1 TO msgs.0
  5172.   SAY msgs.i||CR
  5173.   IF i//linesperpage=0 THEN CALL waiting()
  5174. END
  5175. temp=getinput(1 0 pen3'Select Message Conference: 'def)
  5176. IF ~DATATYPE(temp,'W') | temp<1 | temp>level | FIND(data.21,temp)>0 THEN RETURN 1
  5177. msgdir=temp
  5178. RETURN 0
  5179.  
  5180.  
  5181. chdir:
  5182. string=''
  5183. SAY pen3||LEFT('-',75,'-')||def||CR
  5184. DO i=1 TO libs.0
  5185.   SAY libs.i||CR
  5186. END
  5187. dirnum=getinput(1 0 pen3'Select Library Number: 'def)
  5188. IF ~DATATYPE(dirnum,'W') THEN
  5189.   DO
  5190.     waitchar=dirnum
  5191.     RETURN 2
  5192.   END
  5193.  
  5194. chdir2:
  5195. IF dirnum<1 | dirnum>99 THEN
  5196.   DO
  5197.     waitchar=dirnum
  5198.     RETURN 1
  5199.   END
  5200. IF dirs.dirnum='' THEN
  5201.   DO
  5202.     SAY pen3'That library number is currently un-assigned.'def||CR
  5203.     RETURN 1
  5204.   END
  5205. IF dirnum>level | FIND(data.21,UPPER(dirs.dirnum))>0 THEN
  5206.   DO
  5207.     SAY pen3'You do not have authorization for that library!'def||CR
  5208.     RETURN 1
  5209.   END
  5210. IF dirs.dirnum~='' THEN
  5211.   DO
  5212.     CALL MAKEDIR(libpath||dirs.dirnum)
  5213.     CALL setdir(libpath||dirs.dirnum)
  5214.   END
  5215. RETURN 0
  5216.  
  5217.  
  5218. since:
  5219. dm=DATE(,WORD(data.16,2),'S')
  5220. SAY CR
  5221. SAY 'New files or files moved since' dm||CR
  5222. CALL listsince()
  5223. CALL readlines('RAM:dirlist' 1)
  5224. CALL seelines(1)
  5225. nonstop=0
  5226. CALL waiting()
  5227. RETURN
  5228.  
  5229.  
  5230. listsince:
  5231. dm=DATE(,WORD(data.16,2),'S')
  5232. PARSE VAR dm da' 'mo' 'yr .
  5233. yr=RIGHT(yr,2)
  5234. sincedate=da'-'mo'-'yr
  5235. ADDRESS COMMAND 'C:list >RAM:dirlist' directory 'DATES SINCE' sincedate
  5236. RETURN
  5237.  
  5238.  
  5239. list:
  5240. onetime=0
  5241. IF DATATYPE(arg,'W') THEN onetime=1
  5242. ELSE arg=''
  5243. DO listloop=1
  5244.   IF DATATYPE(arg,'W') THEN
  5245.     DO
  5246.       dirnum=arg
  5247.       arg=''
  5248.       IF chdir2()>0 THEN RETURN
  5249.       CALL listsimple()
  5250.       IF waitchar='Q' THEN RETURN
  5251.       IF onetime THEN LEAVE listloop
  5252.     END
  5253.   ELSE IF arg='' THEN
  5254.     DO
  5255.       IF chdir()>0 THEN RETURN
  5256.       test='Y'
  5257.       CALL showalpha2()
  5258.       arg=''
  5259.       ITERATE listloop
  5260.     END
  5261.   ELSE RETURN
  5262. END
  5263. RETURN
  5264.  
  5265.  
  5266. listsimple:
  5267. ADDRESS COMMAND 'C:list >RAM:dirlist' directory 'DATES'
  5268. IF readlines('RAM:dirlist' 1) THEN RETURN
  5269. IF lynes.0>3 THEN
  5270.   DO
  5271.     SAY pen3'Sorting...'def||lineup||CR
  5272.     linesave=lynes.1  /* these 4 lines put in to leave dir title at top */
  5273.     lynes.1='0'
  5274.     CALL QSORT(1,lynes.0-1,lynes)
  5275.     CALL DELAY(14)
  5276.     lynes.1=linesave
  5277.   END
  5278. CALL seelines(1)
  5279. nonstop=0
  5280. CALL waiting()
  5281. RETURN
  5282.  
  5283.  
  5284. browse:
  5285. curdironly=0
  5286. brdir=PRAGMA('D')
  5287. brfilenum=1
  5288. nonstop=0
  5289. IF files.0<1 THEN RETURN
  5290. lastfilenum=countcheck(bbspath'Numbers/LastFile' 0)
  5291. IF lastfilenum<1 THEN RETURN
  5292. IF arg='' THEN
  5293.   DO
  5294.     test=getinput(1 1 '['pen3'R'def']ead descriptions or ['pen3'A'def']rchive for later download. (aR) > ')
  5295.     IF test='A' THEN
  5296.       DO
  5297.         IF STORAGE()<(bbsprefs.15+100000) THEN
  5298.           DO
  5299.             SAY CR
  5300.             SAY 'Sorry! Not enough memory left for background archiving.'CR
  5301.             SAY 'Please try again in 10 minutes or so.'CR
  5302.             SAY CR
  5303.             RETURN
  5304.           END
  5305.         CALL send2log('Arc: Make_BrowseList.baud')
  5306.         CALL Make_BrowseList.baud(name)
  5307.         IF countcheck(bbspath'Numbers/LastFile' 0)>lastfilenum THEN
  5308.           IF emailonline>=0 THEN emailonline=emailonline+1
  5309.         RETURN
  5310.       END
  5311.     line='Browsing'
  5312.     test=getinput(1 1 'Browse one library only? (Ny) > ')
  5313.     IF test='Y' THEN
  5314.       DO
  5315.         IF chdir()>0 THEN RETURN
  5316.         curdironly=1
  5317.         line=line 'the' pen3||plaindir||def 'library'
  5318.       END
  5319.     ELSE line=line 'all file libraries'
  5320.     line=line 'backwards from latest file.'
  5321.     SAY line||CR
  5322.   END
  5323. i=0
  5324. IF arg='' | UPPER(arg)='NEW' | UPPER(arg)='ALL' THEN
  5325.   DO lastfileloop=1
  5326.     IF lastfilenum<1 THEN RETURN
  5327.     arg=WORD(files.lastfilenum,2)
  5328.     brfilenum=lastfilenum
  5329.     IF WORD(files.lastfilenum,2)~='' THEN LEAVE lastfileloop
  5330.     lastfilenum=lastfilenum-1
  5331.   END
  5332. ELSE IF DATATYPE(arg,'W') & files.arg~='' THEN
  5333.   DO
  5334.     brfilenum=arg
  5335.     arg=WORD(files.arg,2)
  5336.   END
  5337. ELSE
  5338.   DO
  5339.     DO i=1 TO lastfilenum+1
  5340.       IF UPPER(WORD(files.i,2))~=UPPER(arg) THEN ITERATE i
  5341.       brfilenum=i
  5342.       LEAVE i
  5343.     END
  5344.     IF i>lastfilenum THEN
  5345.       DO
  5346.         SAY 'Unable to find a file description for' pen3||arg||def'.'CR
  5347.         RETURN
  5348.       END
  5349.   END
  5350. IF ~curdironly THEN CALL setdir(libpath||WORD(files.brfilenum,1))
  5351. savearg=arg
  5352. IF brfilenum>lastfilenum THEN brfilenum=lastfilenum
  5353. newfilesdate=DATE('S') TIME()
  5354. DO browseloop=1
  5355.   DO i=brfilenum TO 0 BY -1
  5356.     IF files.i='' THEN ITERATE i
  5357.     testdir=UPPER(WORD(files.i,1))
  5358.     IF curdironly & UPPER(plaindir)~=UPPER(testdir) THEN
  5359.       DO
  5360.         IF i>lastbrowse THEN lastbrowse=i
  5361.         ITERATE i
  5362.       END
  5363.     IF FIND(data.21,testdir)>0 | finddirnum(testdir)>level THEN
  5364.       DO
  5365.         IF i>lastbrowse THEN lastbrowse=i
  5366.         ITERATE i
  5367.       END
  5368.     LEAVE i
  5369.   END
  5370.   IF i=0 THEN brfilenum=lastbrowse
  5371.   ELSE brfilenum=i
  5372.   argname=WORD(files.brfilenum,2)
  5373.   IF argname='' THEN RETURN
  5374.   CALL setdir(libpath||WORD(files.brfilenum,1))
  5375.   arg=bbspath'FileNotes/'plaindir'/'argname
  5376.   CALL readlines(arg 1)
  5377.   IF nonstop=1 THEN brostop=1
  5378.   ELSE brostop=0
  5379.   CALL seelines(1)
  5380.   IF brfilenum>lastbrowse THEN lastbrowse=brfilenum
  5381.   CALL checktime()
  5382.   IF brostop THEN
  5383.     DO
  5384.       SAY CR
  5385.       nonstop=1
  5386.       brfilenum=brfilenum-1
  5387.     END
  5388.   ELSE
  5389.     DO
  5390.       line=''
  5391.       endtest=UPPER(RIGHT(argname,4))
  5392.       IF FIND('.ARC .ARJ .DMS .LZH .LHA .RUN .ZIP .ZOO',endtest)>0 THEN
  5393.         line='['pen3'C'def']ontents ['pen3'D'def']ownload'
  5394.       ELSE line='['pen3'D'def']ownload'
  5395.       IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  5396.         line=line '['pen3'E'def']dit'
  5397.       IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  5398.         line=line '['pen3'K'def']ill'
  5399.       IF level>sysoplevel THEN line=line '['pen3'L'def']ib'
  5400.       line=line '['pen3'M'def']ark ['pen3'N'def']on-Stop'
  5401.       IF endtest='.TXT' THEN line=line '['pen3'R'def']ead'
  5402.       line=line '['pen3'Q'def']uit ['pen3'?'def'] > '
  5403.       brcom=getinput(1 0 line)
  5404.       IF DATATYPE(brcom,'W') THEN
  5405.         DO
  5406.           brfilenum=brcom+1
  5407.           IF brfilenum>lastfilenum THEN brfilenum=lastfilenum+1
  5408.           IF brfilenum<1 THEN brfilenum=1
  5409.           SAY CR
  5410.         END
  5411.       ELSE brcom=LEFT(brcom,1)
  5412.       CALL cleanline(0)
  5413.       IF brcom='Q' THEN LEAVE browseloop
  5414.       IF brcom='M' THEN
  5415.         DO
  5416.           wordnum=FIND(data.25,brfilenum)
  5417.           IF wordnum=0 THEN
  5418.             DO
  5419.               data.25=STRIP(data.25 brfilenum)
  5420.               SAY lineup||argname 'marked for next download.'CR
  5421.               SAY CR
  5422.             END
  5423.           ELSE
  5424.             DO
  5425.               data.25=STRIP(DELWORD(data.25,wordnum,1))
  5426.               SAY argname 'removed from download list.'CR
  5427.             END
  5428.         END
  5429.       IF brcom='H' | brcom='?' THEN
  5430.         DO
  5431.           SAY pen3' - HELP with the Browse Files commands -'def||CR
  5432.           SAY ' RETURN reads the next file description in line.'CR
  5433.           SAY ' 34 will display the description of file number 34, if it exists.'CR
  5434.           SAY ' C  displays the contents of an archived (arc dms lzh lha zip zoo) file.'CR
  5435.           SAY ' D  displays the download menu.'CR
  5436.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  5437.             DO
  5438.           SAY ' E  puts this file description into the online Editor.'CR
  5439.           SAY ' K  deletes a file you uploaded. you cannot Kill others!'CR
  5440.             END
  5441.           IF level>sysoplevel THEN
  5442.           SAY ' L  move file and description to new Library and/or rename.'CR
  5443.           SAY ' M  mark/unmark the current file for the next download'CR
  5444.           SAY ' N  displays all descriptions without pausing. CTRL-E to Exit!'CR
  5445.           SAY ' R  displays file as text. - ONLY FILES THAT END IN .TXT -'CR
  5446.           SAY ' Q  returns to the main menu(s). (Quit)'CR
  5447.           SAY CR
  5448.           CALL waiting()
  5449.           IF waitchar='Q' THEN LEAVE browseloop
  5450.         END
  5451.       ELSE IF brcom='L' & level>sysoplevel THEN
  5452.         DO
  5453.           curdir=PRAGMA('D')
  5454.           IF getinput(1 1 'Rename' argname '? (Ny) > ')='Y' THEN
  5455.             DO
  5456.               newarg=getinput(0 0 'Rename' argname 'to ')
  5457.               IF newarg~='' THEN
  5458.                 DO
  5459.                   IF is_here(newarg) THEN ITERATE browseloop
  5460.                   IF EXISTS(libpath||filedir'/'newarg) THEN
  5461.                     DO
  5462.                       SAY CR
  5463.                       SAY '***' newarg 'already exists!'CR
  5464.                       SAY CR
  5465.                       ITERATE browseloop
  5466.                     END
  5467.                   junk=getinput(1 1 'Are you SURE you want to rename' argname 'to' newarg'? (Ny) ')
  5468.                   IF junk='Y' THEN
  5469.                     DO
  5470.                       lynes.2=OVERLAY(newarg,lynes.2,7,25)
  5471.                       comment=WORD(STATEF(arg),8)
  5472.                       CALL DELETE(arg)
  5473.                       arg=bbspath'FileNotes/'plaindir'/'newarg
  5474.                       CALL savelines(arg)
  5475.                       IF comment~='' THEN
  5476.                         ADDRESS COMMAND 'C:FileNote' arg comment
  5477.                       mpath=libpath||plaindir
  5478.                       CALL RENAME(mpath'/'argname,mpath'/'newarg)
  5479.                       files.brfilenum=STRIP(WORD(files.brfilenum,1)) newarg
  5480.                       anum=files.brfilenum.0
  5481.                       alpha.anum=OVERLAY(newarg,alpha.anum,1,WORDINDEX(alpha.anum,2)-2)
  5482.                       CALL send2log('RENAME:' argname 'to' newarg 'in' plaindir)
  5483.                       argname=newarg
  5484.                       sortalphaflag=1
  5485.                       savefileflag=1
  5486.                     END
  5487.                 END
  5488.             END
  5489.           mvdir=getinput(0 0 'Move' argname 'to Library (name|number) ')
  5490.           IF mvdir~='' THEN
  5491.             DO
  5492.               IF DATATYPE(mvdir,'W') THEN
  5493.                 DO
  5494.                   dirnum=mvdir
  5495.                   IF UPPER(dirs.dirnum)~=UPPER(WORD(files.brfilenum,1)) THEN
  5496.                     DO
  5497.                       IF chdir2()=0 THEN
  5498.                         CALL movefile(brfilenum dirs.dirnum)
  5499.                     END
  5500.                 END
  5501.               ELSE
  5502.                 DO
  5503.                   mvdir=STRIP(mvdir)
  5504.                   IF UPPER(mvdir)~=UPPER(WORD(files.brfilenum,1)) THEN
  5505.                     DO
  5506.                       DO mj=1 TO level+1
  5507.                         IF UPPER(mvdir)=UPPER(dirs.mj) THEN LEAVE mj
  5508.                       END
  5509.                       IF mj<=level THEN CALL movefile(brfilenum mvdir)
  5510.                     END
  5511.                 END
  5512.             END
  5513.           IF savefileflag>0 THEN CALL savefilelist()
  5514.           CALL setdir(curdir)
  5515.         END
  5516.       ELSE IF brcom='N' THEN
  5517.         DO
  5518.           brfilenum=brfilenum-1
  5519.           nonstop=1
  5520.           SAY pen3'To EXIT non-stop scrolling of text, press CTRL-E'def||CR
  5521.           SAY CR
  5522.           CALL DELAY(100)
  5523.           brcom=''
  5524.         END
  5525.       ELSE IF brcom='C' THEN
  5526.         DO
  5527.           temp=STRIP(WORD(STATEF(arg),8))
  5528.           IF temp='' THEN temp=libpath||plaindir'/'argname
  5529.           CALL Contents.rexx(temp)
  5530.           IF EXISTS('RAM:CONTENTS') THEN
  5531.             DO
  5532.               CALL cleanline(1)
  5533.               CALL readlines('RAM:CONTENTS' 1)
  5534.               CALL seelines(0)
  5535.               IF waitchar~='Q' THEN CALL waiting()
  5536.               nonstop=0
  5537.             END
  5538.           ELSE SAY pen3'Not an archived file.'def||CR
  5539.         END
  5540.       ELSE IF brcom='D' THEN
  5541.         DO
  5542.           arg2=arg
  5543.           arg=argname
  5544.           CALL dload()
  5545.           arg=arg2
  5546.         END
  5547.       ELSE IF brcom='E' THEN
  5548.         DO
  5549.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  5550.             DO
  5551.               firstedit=5
  5552.               IF level>sysoplevel THEN firstedit=1
  5553.               CALL bbsED(firstedit arg)
  5554.             END
  5555.         END
  5556.       ELSE IF brcom='K' THEN
  5557.         DO
  5558.           IF level>sysoplevel | name=WORD(lynes.3,2) THEN
  5559.             DO
  5560.               IF getinput(1 1 pen3'Do you really want to kill this file? (nY) >'def)~='N' THEN
  5561.                 DO
  5562.                   tempnum=WORD(lynes.1,2)
  5563.                   IF tempnum=lastfilenum THEN
  5564.                     DO
  5565.                       CALL DELETE(bbspath'Numbers/LastFile')
  5566.                       CALL DELAY(28)
  5567.                       lastfilenum=lastfilenum-1
  5568.                       CALL countcheck(bbspath'Numbers/LastFile' lastfilenum)
  5569.                     END
  5570.                   files.tempnum=''
  5571.                   tempnum2=files.tempnum.0
  5572.                   alpha.tempnum2='0 0' tempnum '100'
  5573.                   IF SHOW('P','BBBBS_LOCAL') THEN CALL savefilelist()
  5574.                   ELSE savefileflag=1
  5575.                   CALL DELETE(argname)
  5576.                   CALL DELETE(arg)
  5577.                   CALL send2log('Killed:' argname)
  5578.                   SAY argname pen3'has been deleted.'def||CR
  5579.                 END
  5580.             END
  5581.         END
  5582.       ELSE IF brcom='R' & endtest='.TXT' THEN
  5583.         DO
  5584.           vcount=WORD(lynes.2,7)+1
  5585.           lynes.2=STRIP(DELWORD(lynes.2,7)) vcount
  5586.           edtype=''
  5587.           CALL savelines(arg)
  5588.           CALL showtext(argname)
  5589.         END
  5590.       ELSE brfilenum=brfilenum-1
  5591.     END
  5592. END
  5593. CALL setdir(brdir)
  5594. waitchar=''
  5595. IF nonstop THEN CALL waiting()
  5596. nonstop=0
  5597. CALL savedata(0)
  5598. RETURN
  5599.  
  5600.  
  5601. movefile:
  5602. PARSE ARG fnum movdir .
  5603. fromdir=STRIP(WORD(files.fnum,1))
  5604. farg=STRIP(WORD(files.fnum,2))
  5605. CALL MAKEDIR(libpath||movdir)
  5606. ADDRESS COMMAND 'C:COPY' libpath||fromdir'/'farg libpath||movdir
  5607. IF EXISTS(libpath||movdir'/'farg) THEN CALL DELETE(libpath||fromdir'/'farg)
  5608. files.fnum=movdir farg
  5609. lynes.3=DELWORD(lynes.3,WORDS(lynes.3),1)
  5610. lynes.3=STRIP(lynes.3) movdir
  5611. CALL MAKEDIR(bbspath'FileNotes/'movdir)
  5612. CALL savelines(bbspath'FileNotes/'movdir'/'farg)
  5613. ndx=files.fnum.0
  5614. dnum=finddirnum(movdir)
  5615. alpha.ndx=OVERLAY(RIGHT(dnum,2) movdir,alpha.ndx,31,15)
  5616. IF EXISTS(bbspath'FileNotes/'movdir'/'farg) THEN
  5617.   DO
  5618.     temp=bbspath'FileNotes/'fromdir'/'farg
  5619.     comment=WORD(STATEF(temp),8)
  5620.     CALL DELETE(temp)
  5621.     IF comment~='' THEN
  5622.       ADDRESS COMMAND 'C:FileNote' bbspath'FileNotes/'movdir'/'farg comment
  5623.   END
  5624. savefileflag=1
  5625. line='Moved:' fromdir'/'farg 'to' movdir
  5626. CALL send2log(line)
  5627. SAY line||CR
  5628. RETURN
  5629.  
  5630.  
  5631. textsearch:
  5632. PARSE ARG sfile' 'sarg
  5633. IF sarg='' THEN RETURN 0
  5634. x=OPEN(f,sfile,'R')
  5635. IF x=0 THEN RETURN 0
  5636. sarg=UPPER(sarg)
  5637. stemp=UPPER(READCH(f,65000))
  5638. CALL CLOSE(f)
  5639. retflag=0
  5640. IF POS(sarg,stemp)>0 THEN retflag=1
  5641. DROP stemp
  5642. RETURN retflag
  5643.  
  5644.  
  5645. bbsSEARCH:
  5646. smenu=menu
  5647. test=UPPER(LEFT(arg,1))
  5648. IF test='F' THEN smenu='FILE'
  5649. IF test='M' THEN smenu='MSG'
  5650. IF test='U' THEN smenu='MAIN'
  5651. IF smenu='ALL' THEN
  5652.   DO
  5653.     junk=getinput(1 1 'Search ['pen3'F'def']iles ['pen3'M'def']essages or ['pen3'U'def']sers (fmu) > ')
  5654.     IF junk='F' THEN smenu='FILE'
  5655.     ELSE IF junk='M' THEN smenu='MSG'
  5656.     ELSE IF junk='U' THEN smenu='MAIN'
  5657.     ELSE RETURN
  5658.   END
  5659. IF WORDS(arg)>1 THEN searcharg=UPPER(SUBSTR(arg,WORDINDEX(arg,2)))
  5660. ELSE searcharg=getinput(0 0 pen3'Search Phrase: 'def)
  5661. IF LENGTH(STRIP(searcharg))=0 THEN RETURN
  5662. searcharg=COMPRESS(searcharg,'*')
  5663. CALL send2log('SEARCH:' smenu 'for' searcharg)
  5664. IF smenu='NEW' | smenu='MAIN' THEN
  5665.   DO
  5666.     SAY 'Searching Userlist...'CR
  5667.     DO i=1 TO WORDS(userlist)
  5668.       IF POS(UPPER(searcharg),UPPER(WORD(userlist,i)))>0 THEN
  5669.         SAY WORD(userlist,i)||CR
  5670.     END
  5671.   END
  5672. IF smenu='MSG' THEN
  5673.   DO
  5674.     SAY 'Searching Message Conferences for'pen3 searcharg||def'...'CR
  5675.     SAY CR
  5676.     DO msgdir=1 TO level
  5677.       IF msg.msgdir='' | FIND(data.21,msgdir)>0 THEN ITERATE msgdir
  5678.       CALL searchmsgdir()
  5679.       IF msgcom='Q' THEN LEAVE msgdir
  5680.     END
  5681.   END
  5682. IF smenu='FILE' THEN
  5683.   DO
  5684.     SAY pen3'WARNING!'def 'Searching' files.0 '['pen3'F'def']ull descriptions may take'pen3 TRUNC(files.0/(114*cpu)+.05,1) def'minutes!'CR
  5685.     test=getinput(1 1 ' ['pen3'A'def']lphaList search or ['pen3'F'def']ull descriptions? (Afq) > ')
  5686.     IF test='Q' THEN RETURN
  5687.     IF test~='F' THEN
  5688.       DO
  5689.         SAY CR
  5690.         SAY pen3'Searching files for'def UPPER(searcharg)||CR
  5691.         CALL fileheader()
  5692.         DO i=1 TO alpha.0
  5693.           IF WORD(alpha.i,4)>level THEN ITERATE i
  5694.           ii=WORD(alpha.i,3)
  5695.           IF POS(UPPER(WORD(files.ii,1)),data.21)>0 THEN ITERATE i
  5696.           tempnum=POS(UPPER(searcharg),UPPER(alpha.i))
  5697.           IF tempnum>0 THEN
  5698.             DO
  5699.               SAY alpha.i||CR
  5700.               IF colorflag=1 THEN
  5701.                 SAY pen3||LEFT(' ',tempnum-1)||lineup||UPPER(searcharg)||def||CR
  5702.             END
  5703.         END
  5704.       END
  5705.     ELSE
  5706.       DO
  5707.         SAY CR
  5708.         SAY pen3'Searching files for'def UPPER(searcharg)||CR
  5709.         SAY pen3' - To ABORT, press CTRL-E -'def||CR
  5710.         SAY CR
  5711.         cck=countcheck(bbspath'Numbers/LastFile' 0)
  5712.         nonstop=1
  5713.         DO i=1 TO cck
  5714.           iii=cck+1-i
  5715.           IF files.iii='' THEN ITERATE i
  5716.           farg=WORD(files.iii,1)'/'WORD(files.iii,2)
  5717.           ii=files.iii.0
  5718.           IF WORD(alpha.ii,4)>level THEN ITERATE i
  5719.           IF POS(UPPER(WORD(files.iii,1)),data.21)>0 THEN ITERATE i
  5720.           SAY '1B'x'M' RIGHT(farg,40) LEFT(iii,7)||CR
  5721.           IF textsearch(bbspath'FileNotes/'farg searcharg) THEN
  5722.             DO
  5723.               savei=i
  5724.               CALL readlines(bbspath'FileNotes/'farg 1)
  5725.               CALL seelines(2)
  5726.               i=savei
  5727.               SAY CR
  5728.               SAY CR
  5729.             END
  5730.         END
  5731.       END
  5732.   END
  5733. searcharg=''
  5734. nonstop=0
  5735. CALL waiting()
  5736. RETURN
  5737.  
  5738.  
  5739. searchmsgdir:
  5740. msglist=SHOWDIR(msgpath||msgdir)
  5741. IF WORDS(msglist)>0 THEN SAY lineup||RIGHT(msg.msgdir,40)||CR
  5742. DO sri=1 TO WORDS(msglist)
  5743.   messnum=WORD(msglist,sri)%1
  5744.   IF textsearch(msgpath||msgdir'/'messnum searcharg) THEN
  5745.     DO
  5746.       savelast=lastread.msgdir
  5747.       CALL readmsg(0 messnum)
  5748.       lastread.msgdir=savelast
  5749.       IF msgcom='Q' THEN RETURN
  5750.     END
  5751. END
  5752. RETURN
  5753.  
  5754.  
  5755. finddirnum:
  5756. ARG fdirname .
  5757. DO fdir=1 TO 99
  5758.   IF UPPER(dirs.fdir)=UPPER(fdirname) THEN RETURN fdir
  5759. END
  5760. RETURN 100
  5761.  
  5762.  
  5763. writebuffer:
  5764. PARSE ARG bufname .
  5765. Capture OFF
  5766. CALL DELETE(bufname)
  5767. SAY 'Type 'pen3'/E'def' or 'pen3'/S'def' on a new line to Exit and Save.'CR
  5768. IF EXISTS(bufname) THEN
  5769.   DO
  5770.     CALL DELAY(56)
  5771.     CALL DELETE(bufname)
  5772.     CALL DELAY(56)
  5773.   END
  5774. CaptWrap 74
  5775. Send pen3
  5776. Capture bufname
  5777. Send def
  5778. TimeOut 120
  5779. DO bufloop=1
  5780.   Wait '/E,/S,RING,NO CARRIER'
  5781.   Status 'L'
  5782.   test=LEFT(UPPER(cleanstring(0':'RESULT)),2)
  5783.   IF test='/E' | test='/S' THEN LEAVE bufloop
  5784.   CALL checkdcd()
  5785. END
  5786. Send '\b\b'pen3
  5787. Capture OFF
  5788. CALL checkdcd()
  5789. TimeOut maxidle
  5790. SAY def||CR
  5791. startnum=lynes.0+1
  5792. CALL readlines(bufname startnum)
  5793. CALL wrapbuf(startnum)
  5794. QUEUE CR
  5795. RETURN
  5796.  
  5797.  
  5798. wrapbuf:
  5799. ARG startnum .
  5800. CALL cleanline(1)
  5801. SAY pen3'Wordwrapping...'def||CR
  5802. lynes.startnum=TRANSLATE(lynes.startnum,' ','09'x)
  5803. lynes.startnum=cleanstring(2':'lynes.startnum)
  5804. DO wi=startnum WHILE wi<=lynes.0
  5805.   wj=wi+1
  5806.   lynes.wj=TRANSLATE(lynes.wj,' ','09'x)
  5807.   lynes.wj=cleanstring(2':'lynes.wj)
  5808.   IF LENGTH(lynes.wi)>75 THEN
  5809.     DO
  5810.       testchar=''
  5811.       IF lynes.wj~='' THEN testchar=LEFT(lynes.wj,1)
  5812.       IF testchar=' ' | testchar='.' | testchar=':' THEN
  5813.         DO
  5814.           DO wjj=lynes.0 TO wi+1 BY -1
  5815.             wk=wjj+1
  5816.             lynes.wk=lynes.wjj
  5817.           END
  5818.           lynes.wj=''
  5819.           lynes.0=lynes.0+1
  5820.         END
  5821.       DO wl=WORDS(lynes.wi) TO 1 BY -1 WHILE LENGTH(lynes.wi)>74
  5822.         IF WORDS(lynes.wi)=1 THEN
  5823.           lynes.wi=LEFT(lynes.wi,74) SUBSTR(lynes.wi,75)
  5824.         lynes.wj=WORD(lynes.wi,wl) lynes.wj
  5825.         lynes.wi=STRIP(DELWORD(lynes.wi,wl,1))
  5826.       END
  5827.     END
  5828. END
  5829. RETURN
  5830.  
  5831.  
  5832. seelines:
  5833. ARG fancy .
  5834. DO i=1 TO lynes.0
  5835.   IF fancy=0 THEN SAY lynes.i||def||CR
  5836.   ELSE
  5837.     DO
  5838.       IF LEFT(lynes.i,2)=': ' & WORDS(lynes.i)=2 THEN ITERATE i
  5839.       ELSE IF LEFT(lynes.i,10)='Directory ' | LEFT(lynes.i,5)='=====' THEN
  5840.         SAY pen3||lynes.i||def||CR
  5841.       ELSE SAY lynes.i||CR
  5842.       IF fancy=2 & colorflag=1 & searcharg~='' THEN
  5843.         DO
  5844.           testpos=POS(UPPER(searcharg),UPPER(lynes.i))
  5845.           IF testpos>0 THEN
  5846.             SAY LEFT(' ',testpos-1)||pen3||lineup||UPPER(searcharg)||def||CR
  5847.         END
  5848.     END
  5849.   IF i//linesperpage=0 THEN
  5850.     IF waiting2() THEN LEAVE i
  5851. END
  5852. nonstop=0
  5853. RETURN
  5854.  
  5855.  
  5856. readlines:
  5857. CALL CLOSE(f)
  5858. PARSE ARG tempname readstart .
  5859. IF ~readopen(tempname) THEN RETURN 1
  5860. IF readstart<2 THEN lynes.=''
  5861. DO ri=readstart
  5862.   line=READLN(f)
  5863.   IF EOF(f) THEN BREAK
  5864.   lynes.ri=line
  5865. END
  5866. lynes.0=ri-1
  5867. CALL CLOSE(f)
  5868. DO ri=lynes.0 TO 0 BY -1 WHILE LENGTH(lynes.ri)=0 | LEFT(UPPER(lynes.ri),2)='/E' | LEFT(UPPER(lynes.ri),2)='/S'
  5869. END
  5870. lynes.0=ri
  5871. RETURN 0
  5872.  
  5873.  
  5874. savelines:
  5875. PARSE ARG tempname .
  5876. IF EXISTS(tempname) & edtype='MAIL' THEN
  5877.   DO
  5878.     ok=OPEN(f,tempname,'A')
  5879.     IF ok~=0 THEN CALL WRITELN(f,INSERT('','',1,74,'^'))
  5880.   END
  5881. ELSE ok=OPEN(f,tempname,'W')
  5882. IF ok=0 THEN
  5883.   DO
  5884.     line='***' tempname 'failed to open for saving!'
  5885.     CALL send2log(line)
  5886.     SAY line||CR
  5887.     RETURN 1
  5888.   END
  5889. DO wi=1 TO lynes.0
  5890.   CALL WRITELN(f,lynes.wi)
  5891. END
  5892. CALL CLOSE(f)
  5893. RETURN 0
  5894.  
  5895.  
  5896. loaduserlist:
  5897. userlist=SHOWDIR(bbspath'Users')
  5898. ulynes.=''
  5899. IF ~EXISTS(bbspath'Lists/USERS') THEN CALL sortuserlist()
  5900. ELSE IF readopen(bbspath'Lists/USERS') THEN
  5901.   DO
  5902.     SAY 'Loading Userlist...'CR
  5903.     DO lui=1
  5904.       line=READLN(f)
  5905.       IF EOF(f) THEN BREAK
  5906.       ulynes.lui=line
  5907.     END
  5908.     ulynes.0=lui-1
  5909.     CALL CLOSE(f)
  5910.   END
  5911. RETURN
  5912.  
  5913.  
  5914. saveuserlist:
  5915. SIGNAL OFF BREAK_E
  5916. IF writeopen(bbspath'Lists/USERS') THEN
  5917.   DO
  5918.     DO i=1 TO ulynes.0
  5919.       CALL WRITELN(f,ulynes.i)
  5920.     END
  5921.     CALL CLOSE(f)
  5922.   END
  5923. RETURN
  5924.  
  5925.  
  5926. sortuserlist:
  5927. SAY 'Rebuilding Userlist...'CR
  5928. sortuserflag=0
  5929. userlist=SHOWDIR(bbspath'Users')
  5930. user.=''
  5931. users=WORDS(userlist)
  5932. user.0=users
  5933. DO uli=1 TO users
  5934.   user.uli=WORD(userlist,uli)
  5935.   uscore=LASTPOS('_',user.uli)
  5936.   IF uscore>0 THEN user.uli=SUBSTR(user.uli,uscore+1)'@'LEFT(user.uli,uscore-1)
  5937. END
  5938. CALL QSORT(1,users,user)
  5939. DO uli=1 TO users
  5940.   uscore=POS('@',user.uli)
  5941.   IF uscore>0 THEN user.uli=SUBSTR(user.uli,uscore+1)'_'LEFT(user.uli,uscore-1)
  5942. END
  5943. ulynes.=''
  5944. ulynes.0=user.0%3
  5945. IF (user.0//3)>0 THEN ulynes.0=ulynes.0+1
  5946. DO i=1 TO ulynes.0
  5947.   ulynes.i=LEFT(user.i,25)
  5948.   DO j=1 TO 2
  5949.     k=i+j*ulynes.0
  5950.     IF k<=users THEN ulynes.i=ulynes.i' 'LEFT(user.k,25)
  5951.   END
  5952. END
  5953. CALL saveuserlist()
  5954. RETURN
  5955.  
  5956.  
  5957. showuserlist:
  5958. IF data.5='' THEN line='Here are the EMail names of your fellow users.'
  5959. ELSE line='   'WORDS(userlist) 'users. Use these names to address messages.'
  5960. SAY pen3||line||def||CR
  5961. DO uli=1 TO ulynes.0
  5962.   SAY ulynes.uli||CR
  5963.   IF uli//linesperpage=0 & uli<ulynes.0 THEN
  5964.     IF waiting2()=1 THEN RETURN
  5965. END
  5966. IF data.5~='' THEN CALL waiting()
  5967. RETURN
  5968.  
  5969.  
  5970. msgcount:
  5971. ARG countdir .
  5972. lastmess=0
  5973. totmsgs=0
  5974. unred=0
  5975. IF ~EXISTS(msgpath||countdir) THEN RETURN
  5976. IF STATEF(msgpath||countdir)=msg.countdir.1 THEN totmsgs=msg.countdir.0
  5977. ELSE
  5978.   DO
  5979.     totmsgs=WORDS(SHOWDIR(msgpath||countdir))
  5980.     msg.countdir.0=totmsgs
  5981.     msg.countdir.1=STATEF(msgpath||countdir)
  5982.   END
  5983. IF countdir>level | FIND(data.21,i)>0 THEN RETURN
  5984. lastread.countdir=WORD(data.22,countdir)
  5985. IF ~DATATYPE(lastread.countdir,'W') THEN lastread.countdir=0
  5986. lastmess=countcheck(bbspath'Numbers/LastMessage'countdir 0)
  5987. IF lastread.countdir<0 THEN RETURN
  5988. firstmess=countcheck(bbspath'Numbers/FirstMessage'countdir 0)
  5989. IF lastread.countdir<firstmess THEN lastread.countdir=firstmess-1
  5990. IF lastmess>0 THEN
  5991.   IF lastread.countdir>=0 THEN
  5992.     DO
  5993.       IF lastread.countdir<(firstmess-1) THEN lastread.countdir=firstmess-1
  5994.       unred=lastmess-lastread.countdir
  5995.       IF unred>totmsgs THEN unred=totmsgs
  5996.       cline=RIGHT(unred,6) 'unread of' RIGHT(lastmess,6)
  5997.       cline=cline 'messages in the 'CENTER(msg.countdir,20)' conference.'
  5998.       IF unred>0 | ~logonflag THEN SAY pen6||cline||def||CR
  5999.     END
  6000. RETURN
  6001.  
  6002.  
  6003. counts:
  6004. SAY CR
  6005. SAY 'Working...'CR
  6006. SAY CR
  6007. temp=''
  6008. DO i=1 TO 4
  6009.   temp=temp||CENTER(copyright.i,75)||'0D0A'x
  6010. END
  6011. CALL SETCLIP('BBS_copyright',temp||CR)
  6012. CALL bbsSTATS.rexx(name colorflag 0 emailonline grand grand2 files.0)
  6013. SAY CR
  6014. CALL waiting2()
  6015. IF waitchar='Q' THEN RETURN
  6016. CALL showmarked()
  6017. CALL logonstats()
  6018. nonstop=0
  6019. CALL waiting()
  6020. RETURN
  6021.  
  6022.  
  6023. countmail:
  6024. SAY '   Counting online email...'lineup||CR
  6025. emailonline=0
  6026. DO ti=1 TO WORDS(userlist)
  6027.   emailonline=emailonline+WORDS(SHOWDIR(bbspath'Email/'WORD(userlist,ti)))
  6028. END
  6029. RETURN
  6030.  
  6031.  
  6032. hourly:
  6033. IF level=99 & nonstop~=1 THEN
  6034.   DO
  6035.     IF getinput(1 1 'Zero The Hourly Averages? (Ny) > ')='Y' THEN
  6036.       ADDRESS COMMAND 'C:Delete >*' bbspath'Numbers/Hourly/#?'
  6037.     CALL cleanline(1)
  6038.   END
  6039. CALL ShowHourly.rexx(name linesperpage colorflag nonstop)
  6040. RETURN
  6041.  
  6042.  
  6043. logonstats:
  6044. IF level=0 THEN RETURN
  6045. SAY bak2||name||def 'Last on' DATE('W',lastondate,'I') DATE(,lastondate,'I') lastontime||CR
  6046. tempnum=countcheck(bbspath'Numbers/LastFile' 0)-lastbrowse
  6047. IF tempnum>files.0 THEN tempnum=files.0
  6048. line='of' RIGHT(countcheck(bbspath'Numbers/LastFile' 0),6) 'public files uploaded.'CR
  6049. IF tempnum>0 THEN SAY RIGHT(tempnum,6) '   new of' RIGHT(files.0,6) 'files online    'line
  6050. ELSE SAY '       No new' line
  6051. totmsg=0
  6052. grand=0
  6053. grand2=0
  6054. DO i=1 TO 99
  6055.   IF msg.i='' THEN ITERATE i
  6056.   CALL msgcount(i)
  6057.   totmsg=totmsg+unred
  6058.   grand=grand+totmsgs
  6059.   grand2=grand2+lastmess
  6060. END
  6061. line=RIGHT(grand2,6) 'public messages written'
  6062. IF totmsg>0 THEN
  6063.   SAY RIGHT(totmsg,6) '   new of' line',' grand 'messages still online.'CR
  6064. ELSE SAY '       No new of' line'.'CR
  6065.  
  6066. callsleft:
  6067. test=WORD(data.11,3)
  6068. IF test<1 THEN
  6069.   line=pen0||bak1' Attention! 'def 'This is your last call for' DATE('W')',' DATE()
  6070. ELSE
  6071.   DO
  6072.     line='You may call' test 'more time'
  6073.     IF test~=1 THEN line=line's'
  6074.     line=line 'today.'
  6075.   END
  6076. SAY line||CR
  6077. RETURN
  6078.  
  6079.  
  6080. checkdcd:
  6081. IF GETCLIP('BBS_interpret')='' THEN
  6082.   DO
  6083.     dcd
  6084.     IF RC=0 THEN
  6085.       DO
  6086.         DO dcds=1 TO 3  /* 5 second delay */
  6087.           CALL DELAY(50)
  6088.           dcd
  6089.           IF RC~=0 THEN RETURN
  6090.         END
  6091.         dcd
  6092.         IF RC=0 THEN
  6093.           DO
  6094.             SAY CR
  6095.             Capture OFF
  6096.             Remote OFF
  6097.             CALL SETCLIP('BBS_disconnect',TIME('C') DATE() name)
  6098.             line='^^^^^ LOST CARRIER! ^^^' DATE() TIME() '^^^^^'
  6099.             SAY line||CR
  6100.             Send '\dATH1\r'
  6101.             CALL send2log(line)
  6102.             CALL sound('ALERT')
  6103.             IF newpassword='' THEN SIGNAL DONE
  6104.             ELSE SIGNAL OUT
  6105.           END
  6106.       END
  6107.   END
  6108. CALL checkexternal()
  6109. RETURN
  6110.  
  6111.  
  6112. sound:
  6113. ARG snd 
  6114. IF bbsprefs.13=1 THEN RETURN
  6115. sndfile=bbspath'Sounds/'snd
  6116. IF ~EXISTS(WORD(sndfile,1)) THEN RETURN
  6117. ADDRESS COMMAND 'c:run >nil: c:sound' sndfile
  6118. RETURN
  6119.  
  6120.  
  6121. checkexternal:
  6122. xmsg=GETCLIP('BBS_MESSAGE')
  6123. Capture
  6124. IF RC=0 & xmsg~='' THEN
  6125.   DO
  6126.     SAY CR
  6127.     SAY bak2' Message From BBBBS: 'def||CR
  6128.     SAY xmsg||CR
  6129.     SAY CR
  6130.     CALL SETCLIP('BBS_MESSAGE')
  6131.   END
  6132. xstring=GETCLIP('BBS_interpret')
  6133. IF xstring~='' THEN
  6134.   DO
  6135.     INTERPRET xstring
  6136.     CALL SETCLIP('BBS_interpret')
  6137.   END
  6138. xcom=GETCLIP('BBS_COMMAND')
  6139. IF xcom~='' THEN
  6140.   DO
  6141.     CALL SETCLIP('BBS_COMMAND')
  6142.     IF POS('G',xcom)>0 THEN SIGNAL LOGOUT2
  6143.     IF opt~='' THEN
  6144.       DO
  6145.         IF POS('M',xcom)>0 THEN CALL validate()
  6146.         IF POS('L',xcom)>0 THEN CALL uplevel()
  6147.         IF POS('T',xcom)>0 THEN CALL uptime()
  6148.         IF POS('R',xcom)>0 THEN CALL upratio()
  6149.       END
  6150.     IF POS('C',xcom)>0 THEN CALL chat()
  6151.   END
  6152. RETURN
  6153.  
  6154.  
  6155. chat:
  6156. chatrequest=0
  6157. chattime=TIME('E')
  6158. SAY 'Entering chat mode with sysop.'CR
  6159. MSG pen3'- Press backslash [\] to exit -'def
  6160. SAY 'Press [RETURN] twice to tell' sysop 'you are finished typing.'CR
  6161. SAY CR
  6162. OPTIONS PROMPT ''
  6163. string=''
  6164. DO WHILE(string~='\')
  6165.   PULL string
  6166.   CALL checkdcd()
  6167. END
  6168. maxtime=maxtime+(TIME('E')-chattime)%1
  6169. RETURN
  6170.  
  6171.  
  6172. readopen:
  6173. PARSE ARG fname
  6174. ok=OPEN(f,fname,'R')
  6175. IF ok~=0 THEN RETURN 1
  6176. line=fname 'failed to open for reading!'
  6177. SAY line||CR
  6178. CALL send2log(line)
  6179. RETURN 0
  6180.  
  6181.  
  6182. writeopen:
  6183. PARSE ARG fname
  6184. CALL CLOSE(f)
  6185. ok=OPEN(f,fname,'W')
  6186. IF ok~=0 THEN RETURN 1
  6187. line=fname 'failed to open for writing!'
  6188. SAY line||CR
  6189. CALL send2log(line)
  6190. RETURN 0
  6191.  
  6192.  
  6193. set_grand:
  6194. SAY 'Setting up public message conferences...'CR
  6195. grand=0
  6196. DO i=1 TO 99
  6197.   IF msg.i='' THEN ITERATE i
  6198.   msg.i.0=WORDS(SHOWDIR(msgpath||i,'F'))
  6199.   msg.i.1=STATEF(msgpath||i)
  6200.   grand=grand+msg.i.0
  6201. END
  6202. RETURN
  6203.  
  6204.  
  6205. checkstats:          /* clip is set and cleared by stats programs */
  6206. IF TIME('H')>3 & GETCLIP('BBS_STAT')='' THEN
  6207.   DO
  6208.     IF EXISTS(bbspath'Information/STATS.ULDL') THEN
  6209.       DO
  6210.         lfinfo=STATEF(bbspath'Information/STATS.ULDL')
  6211.         IF WORD(lfinfo,5)<DATE('I') THEN
  6212.           DO
  6213.             ADDRESS AREXX bbsULDL.rexx
  6214.             CALL DELAY(100)
  6215.           END
  6216.       END
  6217.     IF TIME('H')>4 & GETCLIP('BBS_STAT')='' & EXISTS(bbspath'Information/STATS.USER') THEN
  6218.       DO
  6219.         ufinfo=STATEF(bbspath'Information/STATS.USER')
  6220.         IF WORD(ufinfo,5)<DATE('I') THEN
  6221.           DO
  6222.             ADDRESS AREXX bbsUSER.rexx
  6223.             CALL DELAY(100)
  6224.           END
  6225.       END
  6226.     IF grand>SYSTEM_MSG_LIMIT & TIME('H')>5 & TIME('H')<9 & GETCLIP('BBS_STAT')='' THEN
  6227.       DO
  6228.         SAY 'Doing Message Conference Maintenence...'CR
  6229.         Send 'ATH1\r'
  6230.         CALL bbsMAINT.baud(SYSTEM_MSG_LIMIT sysop)
  6231.         CALL set_grand()
  6232.         Send 'ATZ\r'
  6233.       END
  6234.   END
  6235. RETURN
  6236.  
  6237.  
  6238. zerovars:
  6239. lastread.=0
  6240. totwrit.=0
  6241. data.=''
  6242. libs.=''
  6243. smsg.=''
  6244. msgs.=''
  6245. sdirs.=''
  6246. pasted.=''
  6247. pasted.0=0
  6248. clear_marked=0
  6249. sortalphaflag=0
  6250. savefileflag=0
  6251. sortuserflag=0
  6252. linesperpage=22
  6253. chatrequest=0
  6254. lastbrowse=0
  6255. buildalpha=0
  6256. terseflag=0
  6257. warnings=0
  6258. winnings=0
  6259. menuflag=0
  6260. nonstop=0
  6261. dirnum=1
  6262. msgdir=1
  6263. level=0
  6264. newfilesflag=0
  6265. newfilesdate=''
  6266. newpassword=''
  6267. replymsg=''
  6268. waitchar=''
  6269. string=''
  6270. name=''
  6271. city='?'
  6272. opt=''
  6273. RETURN
  6274.  
  6275.  
  6276. HALT:
  6277. SYNTAX:
  6278. FAILURE:
  6279. lin.1=pen7||ERRORTEXT(RC)||def
  6280. lin.2=SIGL-1     SOURCELINE(SIGL-1)
  6281. lin.3=SIGL pen7||SOURCELINE(SIGL)||def
  6282. lin.4=SIGL+1     SOURCELINE(SIGL+1)
  6283. DO er=1 TO 4
  6284.   IF level>sysoplevel THEN SAY lin.er||CR
  6285.   CALL send2log(lin.er)
  6286. END
  6287. CALL CLOSE(f)
  6288. IF newpassword='' THEN SIGNAL DONE  /* no user logged on, quit quietly */
  6289. SAY CR
  6290. CALL checkdcd()
  6291. IF level>sysoplevel THEN
  6292.   DO
  6293.     junk=getinput(1 1 'ReStart: (Ny) > ')
  6294.     IF junk~='Y' THEN SIGNAL LOGOUT
  6295.   END
  6296. waitchar=''
  6297. IF data.1~='' & data.5~='' & data.20~='' THEN CALL savedata(0)
  6298. SIGNAL RESTART
  6299.  
  6300.  
  6301. BREAK_E:
  6302. CALL CLOSE(f)
  6303. SAY pen3'*** CTRL-E BREAK ***'def||CR
  6304. waitchar=''
  6305. string=''
  6306. nonstop=0
  6307. rnonstop=0
  6308. brostop=0
  6309. i=999999
  6310. wi=999999
  6311. ni=0
  6312. QUEUE CR
  6313. RETURN 0
  6314.  
  6315.  
  6316. BREAK_C:
  6317. SIGNAL OFF BREAK_C
  6318. SIGNAL OFF BREAK_E
  6319. CALL CLOSE(f)
  6320. IF newpassword='' THEN
  6321.   DO
  6322.     CALL SETCLIP('BBS_disconnect',TIME('C') DATE() name)
  6323.     SIGNAL DONE  /* no user logged on, quit quietly */
  6324.   END
  6325. CALL checkdcd()
  6326. SAY CR
  6327. IF warnings<1 THEN  /* just 1 warning */
  6328.   DO
  6329.     warnings=warnings+1
  6330.     SAY CR
  6331.     SAY 'If you didn''t press CTRL-C then...   HEY!    Wake up!'CR
  6332.     SAY '                                     Auto-disconnect in' TRUNC(maxidle/60+.5) 'minutes!'CR
  6333.     SAY CR
  6334.     SAY 'If you DID press CTRL-C,  PLEASE  use CTRL-E next time instead.'CR
  6335.     SAY CR
  6336.     Remote OFF
  6337.     Send '^G\w^G\w^G^G^G^G'
  6338.     Remote ON
  6339.     waitchar=''
  6340.     string=''
  6341.     nonstop=0
  6342.     SIGNAL RESTART
  6343.   END
  6344. CALL SETCLIP('BBS_disconnect',TIME('C') DATE() name)
  6345. SAY 'No Activity For' TRUNC(maxidle/30+.5) 'minutes! -- Disconnecting.'CR
  6346. Send '\d'
  6347. CALL sound('ALERT 2')
  6348. SIGNAL OUT
  6349.  
  6350. LOGOUT:
  6351. junk=getinput(1 1 pen3'Leave Feedback for SysOp? (Ny) > 'def)
  6352. IF junk='Y' THEN
  6353.   DO
  6354.     opt='C'  /* to trigger Feedback as Subject */
  6355.     CALL editor('MAIL' sysop)
  6356.   END
  6357.  
  6358. LOGOUT2:
  6359. CALL checkexternal()
  6360. SIGNAL OFF BREAK_E
  6361. CALL SETCLIP('BBS_level')
  6362. CALL callsleft()
  6363. secs=TIME('E')
  6364. mins=secs%60
  6365. secs=TRUNC(secs//60)
  6366. IF secs<10 THEN secs='0'secs
  6367. SAY
  6368. SAY 'Public  files   online: 'RIGHT(comma(files.0),9)||CR
  6369. SAY 'Public messages online: 'RIGHT(comma(grand),9)||CR
  6370. SAY CR
  6371. SAY 'Time used this call:' mins':'secs||CR
  6372. CALL bbsLOGOFF.baud(name level mins secs) 
  6373. SAY 'Goodbye' name', thank you for calling' bbsname'.'CR
  6374. linesperpage=99
  6375. arg=bbspath'BBS_TEXT/GOODBYE'
  6376. IF EXISTS(arg) THEN
  6377.   DO
  6378.     CALL DELAY(14)
  6379.     CALL readlines(arg 1)
  6380.     CALL seelines(0)
  6381.   END
  6382. SAY CR
  6383. IF bbsprefs.2 & ~terseflag THEN CALL doGrin()
  6384.  
  6385. OUT:
  6386. SIGNAL OFF BREAK_E
  6387. Remote OFF
  6388. data.18=winnings
  6389. line=left(name,16,' ') 'logged off at' time('C')
  6390. dcd
  6391. IF RC~=0 THEN Send '\ah'
  6392. IF data.20~='' THEN
  6393.   DO
  6394.     Status 'Y'
  6395.     elapsed=RESULT
  6396.     line=line 'Total:'elapsed
  6397.     PARSE VAR elapsed thour':'tmin':'.
  6398.     ADDRESS AREXX bbsHOURLY.rexx TIME('H') TIME('M')//60 thour tmin bbspath'Numbers/Hourly'
  6399.     PARSE VAR data.19 dhour 'hours' dmin 'minutes in' calls .
  6400.     IF ~DATATYPE(tmin,'W')  THEN tmin=0
  6401.     IF ~DATATYPE(thour,'W') THEN thour=0
  6402.     IF ~DATATYPE(dhour,'W') THEN dhour=0
  6403.     IF ~DATATYPE(dmin,'W')  THEN dmin=0
  6404.     IF ~DATATYPE(calls,'W') THEN calls=0
  6405.     IF thour=0 & tmin<3 THEN  /* free call if less than 3 minutes */
  6406.       DO
  6407.         wordloc=WORDINDEX(data.11,3)-1
  6408.         wordval=WORD(data.11,3)+1
  6409.         data.11=DELWORD(data.11,3,1)
  6410.         data.11=INSERT(wordval' ',data.11,wordloc)
  6411.       END
  6412.     ufile=LEFT(DATE('S'),6)
  6413.     mmins=thour*60+tmin+countcheck(bbspath'Usage/'ufile 0)
  6414.     mins=thour*60+tmin+countcheck(bbspath'Numbers/Minutes' 0)
  6415.     cals=countcheck(bbspath'Numbers/Calls' 0)+1
  6416.     CALL countcheck(bbspath'Numbers/Minutes' mins)
  6417.     CALL countcheck(bbspath'Numbers/Calls' cals)
  6418.     CALL countcheck(bbspath'Usage/'ufile mmins)
  6419.     thour=thour+dhour
  6420.     tmin=tmin+dmin+1
  6421.     IF tmin>59 THEN
  6422.       DO
  6423.         thour=thour+tmin%60
  6424.         tmin=tmin//60
  6425.       END
  6426.     data.19=thour 'hours' tmin 'minutes in' calls+1 'calls.'
  6427.     CALL SETCLIP('BBS_totalusage',mmins%60 mmins//60)
  6428.     CALL SETCLIP('BBS_userlogoff',TIME('C') DATE())
  6429.     CALL postuser(6)
  6430.     IF newfilesflag=1 THEN
  6431.       DO
  6432.         newfilesdate=DATE('S') TIME()
  6433.         lastbrowse=countcheck(bbspath'Numbers/LastFile' 0)
  6434.       END
  6435.     IF clear_marked=1 THEN data.24=''
  6436.     CALL saveData(1)
  6437.     data.5=''
  6438.     IF EXISTS(bbspath'EmailFiles/'name'/QUICKIN.lha') THEN
  6439.       ADDRESS AREXX bbsQUICKIN.rexx name level sysoplevel bbsprefs.6
  6440.     arg=''
  6441.     lastline=RIGHT(TIME('C'),7) LEFT(DATE(),6)
  6442.     lastline=lastline'  'RIGHT(city,40)
  6443.     lastline=OVERLAY(name,lastline,16,LENGTH(name)+1) RIGHT(bps,5)
  6444.     lastline=lastline' Time:'elapsed
  6445.     newpassword=''
  6446.     CALL send2last(lastline)
  6447.     CALL sound('LOGOFF')
  6448.     SAY lastline||CR
  6449.     CALL bbsLOGOFF.baud(name level elapsed) 
  6450.   END
  6451.  
  6452. OUT2:
  6453. CALL send2log(line)
  6454.  
  6455. DONE:
  6456. CALL send2log('')
  6457. logonflag=0
  6458.  
  6459. DONE2:
  6460. CALL setdir(libpath||dirs.1)
  6461. CALL SETCLIP('BBS_winnings')
  6462. CALL SETCLIP('BBS_minutes')
  6463. CALL SETCLIP('BBS_door_demon')
  6464. CALL SETCLIP('BBS_level')
  6465. IF SHOW('P','BBS_DOOR_DEMON') THEN CALL SETCLIP('BBS_door_demon','QUIT')
  6466. Capture
  6467. IF RC~=0 THEN Capture OFF
  6468. Send '\c\ah'
  6469. CALL DELAY(14)
  6470. Remote OFF
  6471. baud maxbps
  6472. IF sortuserflag=0 & sortalphaflag=0 & savefileflag=0 & emailonline>=0 & buildalpha=0 THEN
  6473.   CALL DELAY(100)
  6474. ELSE
  6475.   DO
  6476.     Send 'ATH1\r'
  6477.     CALL DELAY(128)
  6478.     Send 'ATH1\r'
  6479.   END
  6480. IF buildalpha~=0 THEN
  6481.   DO
  6482.     CALL BuildALPHA.rexx()
  6483.     sortalphaflag=0
  6484.     savefileflag=0
  6485.     buildalpha=0
  6486.   END
  6487. IF sortuserflag=1 THEN
  6488.   DO
  6489.     CALL sortuserlist()
  6490.     IF SHOW('P','BBBBS_LOCAL') THEN
  6491.       DO
  6492.         CALL SETCLIP('BBS_localusers')
  6493.         CALL SETCLIP('BBS_mainusers',1)
  6494.       END
  6495.   END
  6496. IF sortalphaflag>0 | savefileflag>0 THEN
  6497.   DO
  6498.     IF savefileflag>0 THEN CALL savefilelist2()
  6499.     ELSE CALL savealphalist()
  6500.     IF SHOW('P','BBBBS_LOCAL') THEN CALL SETCLIP('BBS_mainfiles',2)
  6501.   END
  6502. IF emailonline<0 THEN CALL countmail()
  6503. bad_atz=ATZreset()   /* reset modem */
  6504. IF bbsprefs.15=0 THEN  /* quit or restart? */
  6505.   DO
  6506.     CALL checkstats()
  6507.     EXIT
  6508.   END
  6509. IF STORAGE()<bbsprefs.15 THEN
  6510.   DO
  6511.     SAY CR
  6512.     SAY '*** Unsafe memory level!'CR
  6513.     line='*** Less than' bbsprefs.15 'bytes available, BBBBS has been unloaded.'
  6514.     SAY line||CR
  6515.     SAY CR
  6516.     CALL send2log(line)
  6517.     EXIT
  6518.   END
  6519. CALL CLOSE(f)
  6520. CALL CLOSE('log')
  6521. CALL zerovars()
  6522. DO FOREVER
  6523.   IF GETCLIP('BBS_QUIT')='QUIT' THEN
  6524.     DO
  6525.       CALL SETCLIP('BBS_QUIT')
  6526.       CALL SETCLIP('BBS_maint')
  6527.       CALL SETCLIP('BBS_localfiles')
  6528.       CALL SETCLIP('BBS_localusers')
  6529.       Send '\c'
  6530.       EXIT
  6531.     END
  6532.   xstring=GETCLIP('BBS_interpret')
  6533.   IF xstring~='' THEN
  6534.     DO
  6535.       INTERPRET xstring
  6536.       CALL SETCLIP('BBS_interpret')
  6537.       SIGNAL DONE2
  6538.     END
  6539.   IF bad_atz=1 THEN bad_atz=ATZreset()
  6540.   IF GETCLIP('BBS_localfiles')>1 & GETCLIP('BBS_maint')='' THEN
  6541.     DO
  6542.       CALL DELAY(150)
  6543.       Send 'ATH1\r'
  6544.       CALL SETCLIP('BBS_localfiles')
  6545.       CALL loadfiles()
  6546.       CALL loadalpha()
  6547.       SIGNAL DONE2
  6548.     END
  6549.   IF GETCLIP('BBS_localusers')~='' THEN
  6550.     DO
  6551.       CALL DELAY(150)
  6552.       Send 'ATH1\r'
  6553.       CALL SETCLIP('BBS_localusers')
  6554.       CALL loaduserlist()
  6555.       SIGNAL DONE2
  6556.     END
  6557.   dcd
  6558.   IF RC~=0 THEN Send '\ah'
  6559.   wres=''
  6560.   Wait 'RING'
  6561.   wres=RESULT
  6562.   IF wres='RING' THEN
  6563.     DO
  6564.       Send 'ATA\r'
  6565.       Timeout 45
  6566.       wres=''
  6567.       Wait 'CONNECT,NO CARRIER,RING,+FCON,+FHNG' /* wait 45 seconds for connect */
  6568.       wres=RESULT
  6569.       IF wres~='CONNECT' THEN SIGNAL DONE2
  6570.       CALL DELAY(114)
  6571.       SAY ' 'CR
  6572.       CALL DELAY(28)
  6573.       SAY ' 'CR
  6574.       dcd
  6575.       IF RC=0 THEN
  6576.         DO
  6577.           CALL DELAY(128)
  6578.           dcd
  6579.           IF RC=0 THEN
  6580.             DO
  6581.               CALL DELAY(128)
  6582.               dcd
  6583.               IF RC=0 THEN SIGNAL DONE2
  6584.             END
  6585.         END
  6586.       IF GETCLIP('BBS_maint')='' THEN
  6587.         DO
  6588.           CALL SETCLIP('BBS_interpret')
  6589.           CALL DELAY(114)
  6590.           SIGNAL LOGON
  6591.         END
  6592.       Remote ON
  6593.       SAY bbsname 'is busy with periodic maintenance.'CR
  6594.       SAY 'Please try again in a few minutes.'CR
  6595.       Send '\ah'
  6596.       SIGNAL DONE2
  6597.     END
  6598.   ELSE CALL checkstats()
  6599. END
  6600. EXIT
  6601.  
  6602.  
  6603.  
  6604. ATZreset:
  6605. TimeOut 10
  6606. Send 'ATZ\r'
  6607. Wait 'OK,RING'
  6608. IF RESULT~='OK' THEN
  6609.   DO
  6610.     Send '\d\wATZ\r'
  6611.     Wait 'OK'
  6612.     IF RESULT~='OK' THEN
  6613.       DO
  6614.         Send '\w\w+++\w\w\w\wATH\r'
  6615.         CALL sound('ALERT 3')
  6616.         line='*** ATZ failed to reset!' TIME('C') DATE()
  6617.         SAY line'  Check your modem!!'CR
  6618.         CALL send2log(line)
  6619.         RETURN 1
  6620.       END
  6621.   END
  6622. TimeOut 45
  6623. Send '\dATH\r'
  6624. RETURN 0
  6625.  
  6626.  
  6627. getbaudrate: PROCEDURE
  6628. TRACE OFF
  6629. BaudRate
  6630. brate=RC
  6631. TRACE
  6632. RETURN brate
  6633.  
  6634.  
  6635. /* BBBBS.baud */
  6636.